[Haskell-cafe] csv one-liner
derek.a.elkins at gmail.com
Wed Oct 1 09:32:36 EDT 2008
On Wed, 2008-10-01 at 10:15 +0200, Ketil Malde wrote:
> Derek Elkins <derek.a.elkins at gmail.com> writes:
> >> parseCSVFromFile "in.csv" >>= return . either (const "error!")
> > Whenever you see this >>= return . f pattern think liftM or fmap or <$>.
> ...and "return . f >>= action" is just "action . f", no?
Well actually that's \x -> action (return (f x)) x via the (r ->)
instance of Monad. I think what you wanted was
\x -> return (f x) >>= action which is
\x -> action (f x)
action . f via the monad laws.
More information about the Haskell-Cafe