Safe Haskell | None |
---|---|
Language | Haskell98 |
Deprecated: Use Data.Map.Syntax from the map-syntax package instead
An API implementing a convenient syntax for defining and manipulating splices. This module was born from the observation that a list of tuples is semantically ambiguous about how duplicate keys should be handled. Additionally, the syntax is inherently rather cumbersome and difficult to work with. This API takes advantage of do notation to provide a very light syntax for defining splices while at the same time eliminating the semantic ambiguity of alists.
Here's how you can define splices:
mySplices :: Splices Text mySplices = do "firstName" ## "John" "lastName" ## "Smith"
- type SplicesM s a = MapSyntaxM Text s a
- type Splices s = MapSyntax Text s
- noSplices :: Splices s
- mapS :: (a -> b) -> Splices a -> Splices b
- applyS :: a -> Splices (a -> b) -> Splices b
- ($$) :: Splices (a -> b) -> a -> Splices b
- mapNames :: (Text -> Text) -> Splices a -> Splices a
- prefixSplices :: Text -> Text -> Splices a -> Splices a
- namespaceSplices :: Text -> Splices a -> Splices a
- module Data.Map.Syntax
Documentation
type SplicesM s a = MapSyntaxM Text s a Source
mapNames :: (Text -> Text) -> Splices a -> Splices a Source
Maps a function over all the splice names.
prefixSplices :: Text -> Text -> Splices a -> Splices a Source
Adds a prefix to the tag names for a list of splices. If the existing tag name is empty, then the new tag name is just the prefix. Otherwise the new tag name is the prefix followed by the separator followed by the existing name.
namespaceSplices :: Text -> Splices a -> Splices a Source
prefixSplices
specialized to use a colon as separator in the style of
XML namespaces.
module Data.Map.Syntax