
12 Mar
2009
12 Mar
'09
10:43 p.m.
On Fri, 13 Mar 2009 14:32:23 +0000
Ross Paterson
On Fri, Mar 13, 2009 at 03:18:15PM +0100, Martijn van Steenbergen wrote:
Are there any functors f for which no point/pure/return :: a -> f a exists?
No. Choose an arbitrary element shape :: f () and define
point x = fmap (const x) shape
This suggests a fun way to define a monad for a functor F: -- Does nothing, has no effect, and returns () noOp :: F () noOp = ... instance Monad F where return x = fmap (const x) noOp (<<=) f x = ... I think noOp would be a nice addition to the Monad class, as well. -- Robin