| Copyright | (C) 2016-2018 David M. Johnson |
|---|---|
| License | BSD3-style (see the file LICENSE) |
| Maintainer | David M. Johnson <djohnson.m@gmail.com> |
| Stability | experimental |
| Portability | non-portable |
| Safe Haskell | None |
| Language | Haskell2010 |
Miso.Util
Description
Synopsis
- withFoldable :: Foldable t => t a -> (a -> b) -> [b]
- conditionalViews :: Bool -> [View action] -> [View action]
- (=:) :: k -> a -> Map k a
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) ]