Hello everyone,
I am quite new to monadic code so I would like to ask for improvement
suggestions on the last line of the code below.
I know I could do something like do strs - mapM ...; intercalate ...
etc, but I would like to avoid the use of -.
Thank you,
José
data XmlState = XmlState
On 15/08/12 17:01, José Lopes wrote:
someFn docs =
return concat `ap` (sequence $ intersperse (return \n) (map loop docs))
First of all, return x `ap` y = x `fmap` y or x $ y. fmap (or its infix
synonym ($)) is the answer here, you could write:
someFn docs = concat . intersperse \n $
Try:
concat . intersperse \n $ (sequence $ map loop docs)
On Wed, Aug 15, 2012 at 11:01 AM, José Lopes jose.lo...@ist.utl.pt wrote:
Hello everyone,
I am quite new to monadic code so I would like to ask for improvement
suggestions on the last line of the code below.
I know I could do
Thank you.
On 15-08-2012 23:09, Twan van Laarhoven wrote:
On 15/08/12 17:01, José Lopes wrote:
someFn docs =
return concat `ap` (sequence $ intersperse (return \n) (map loop
docs))
First of all, return x `ap` y = x `fmap` y or x $ y. fmap (or
its infix synonym ($)) is the answer here,