[Haskell-cafe] Improvement suggestions

José Lopes jose.lopes at ist.utl.pt
Wed Aug 15 17:01:19 CEST 2012

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,

data XmlState = XmlState Int
type XmlM a = State XmlState a

loop :: Document -> XmlM String

someFn :: [Document] -> XmlM String
someFn docs =
   return concat `ap` (sequence $ intersperse (return "\n") (map loop 
docs))    <--- improve this line

José António Branquinho de Oliveira Lopes
58612 - MEIC-A
Instituto Superior Técnico (IST), Universidade Técnica de Lisboa (UTL)
jose.lopes at ist.utl.pt

More information about the Haskell-Cafe mailing list