miso-1.2.0.0: A tasty Haskell front-end framework

Copyright(C) 2016-2018 David M. Johnson
LicenseBSD3-style (see the file LICENSE)
MaintainerDavid M. Johnson <djohnson.m@gmail.com>
Stabilityexperimental
Portabilitynon-portable
Safe HaskellNone
LanguageHaskell2010

Miso.Util

Description

 
Synopsis

Documentation

withFoldable :: Foldable t => t a -> (a -> b) -> [b] Source #

Generic map function, useful for creating Views from the elements of some Foldable. Particularly handy for Maybe, as shown in the example below.

view model =
    div_ [] $
     withFoldable (model ^. mSomeMaybeVal) $ someVal ->
        p_ [] [ text $ "Hey, look at this value: " <> ms (show someVal) ]

conditionalViews :: Bool -> [View action] -> [View action] Source #

Hides the Views the condition is False. Shows them when the condition is True.

(=:) :: k -> a -> Map k a Source #

Smart constructor for Attributes. This function is helpful when constructing numerous Attributes Example shown below.

div_ [ style_  $ ("background" =: "red" <> "width" =: "250px" <> "height" =: "250px") ] []