Skip to content

Comment on Haskell style list comprehensions in Rubyparent

Comments

They're equivalent to do-notation in the List monad so as long as you don't really need the inline syntax you can just mechanically translate it to do nation and back.

And with -XMonadComprehensions you can have the compiler do that for a whole bunch more Monads.

It's also possible to just use Applicative with <*> and <$>

AboutSource Built by g1lg1l

Hackerly is an independent reader for Hacker News, built on the public HN API. Not affiliated with Y Combinator.