[Haskell-cafe] Funny State monad dependency

Roberto Zunino zunino at di.unipi.it
Wed Apr 16 09:22:47 EDT 2008

Miguel Mitrofanov wrote:
> It has nothing to do with State; it actually works in List monad. 
> "return y" is just another way of writing "[y]".

Actually, it seems that in this case return is from the ((->) a) monad, 
i.e. return=const.

f x y = x >>= return y
       = x >>= const y
       = (concat . map) (const y) x
       = concat (map (const y) x)


More information about the Haskell-Cafe mailing list