Semicolon value in lambda expression
2 answers
They just separate the two expressions f x
and return x
in notation. In fact, they are all equivalent in your case:
iofunc_ s f = Command s (\x -> do f x ; return x)
iofunc_ s f = Command s (\x -> do {f x ; return x})
iofunc_ s f = Command s (\x -> do f x
return x)
iofunc_ s f = Command s (\x -> f x >> return x)
+8
source to share
A semicolon anywhere is equivalent to changing the indented line at the same level as the previous valid expression.
I saw this while looking at how indentation works ( https://en.wikibooks.org/wiki/Haskell/Indentation ).
+1
source to share