map f [x1, x2, ..., xn] == [f x1, f x2, ..., f xn] map f [x1, x2, ...] == [f x1, f x2, ...]this means that map id == id
>>> map (+1) [1, 2, 3] [2,3,4]
>>> map id [1, 2, 3] [1,2,3]
>>> map (\n -> 3 * n + 1) [1, 2, 3] [4,7,10]
>>> HashSet.map show (HashSet.fromList [1,2,3]) HashSet.fromList ["1","2","3"]
map f [x1, x2, ..., xn] == [f x1, f x2, ..., f xn] map f [x1, x2, ...] == [f x1, f x2, ...]
>>> map (+1) [1, 2, 3] [2,3,4]
map $ span $ toHtml "foo"Result:
<map><span>foo</span></map>
map id = cat map (g . f) = map f >-> map g
toNonEmpty (map f xs) = map f (toNonEmpty xs)
Streams.map (g . f) === Streams.map f >=> Streams.map g Streams.map id === Streams.makeInputStream . Streams.read
>>> S.stdoutLn $ S.map reverse $ each (words "alpha beta") ahpla ateb
>>> input (Dhall.map strictText bool) "toMap { a = True, b = False }"
fromList [("a",True),("b",False)]
>>> input (Dhall.map strictText bool) "[ { mapKey = \"foo\", mapValue = True } ]"
fromList [("foo",True)]
If there are duplicate mapKeys, later mapValues take
precedence:
>>> let expr = "[ { mapKey = 1, mapValue = True }, { mapKey = 1, mapValue = False } ]"
>>> input (Dhall.map natural bool) expr
fromList [(1,False)]