Copyright | (c) Microsoft |
---|---|

License | MIT |

Maintainer | adamsap@microsoft.com |

Stability | provisional |

Portability | portable |

Safe Haskell | Safe |

Language | Haskell98 |

Helper functions for combining elements into common constructs. These functions
can be used in code generation to lazily combine `Text`

elements but they are
more generic and work for any `Monoid`

.

- sepBy :: (Monoid a, Eq a) => a -> (b -> a) -> [b] -> a
- sepEndBy :: (Monoid a, Eq a) => a -> (b -> a) -> [b] -> a
- sepBeginBy :: (Monoid a, Eq a) => a -> (b -> a) -> [b] -> a
- optional :: Monoid m => (a -> m) -> Maybe a -> m
- ifThenElse :: Bool -> a -> a -> a
- angles :: (Monoid a, IsString a, Eq a) => a -> a
- brackets :: (Monoid a, IsString a, Eq a) => a -> a
- braces :: (Monoid a, IsString a, Eq a) => a -> a
- parens :: (Monoid a, IsString a, Eq a) => a -> a
- between :: (Monoid a, Eq a) => a -> a -> a -> a

# Documentation

sepBy :: (Monoid a, Eq a) => a -> (b -> a) -> [b] -> a Source #

Maps elements of a list and combines them with `mappend`

using given
separator.

sepEndBy :: (Monoid a, Eq a) => a -> (b -> a) -> [b] -> a Source #

Maps elements of a list and combines them with `mappend`

using given
separator, ending with a separator.

sepBeginBy :: (Monoid a, Eq a) => a -> (b -> a) -> [b] -> a Source #

Maps elements of a list and combines them with `mappend`

using given
separator, starting with a separator.

ifThenElse :: Bool -> a -> a -> a Source #