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 something like "do strs <- mapM ...; intercalate ..." > etc, but I would like to avoid the use of "<-". > > Thank you, > José > > 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.lo...@ist.utl.pt > > > ______________________________**_________________ > Haskell-Cafe mailing list > Haskell-Cafe@haskell.org > http://www.haskell.org/**mailman/listinfo/haskell-cafe<http://www.haskell.org/mailman/listinfo/haskell-cafe> > >
_______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe