
13 Mar
2009
13 Mar
'09
11:10 a.m.
On Fri, Mar 13, 2009 at 02:32:23PM +0000, Ross Paterson wrote:
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
But since f may be polymorphic in some other types, it may not be possible to choose such an arbitrary shape. For example, ((,) w) is a Functor but it is not possible to define a function point :: a -> (w,a) without (1) using undefined for the value of type w, or (2) putting some sort of constraint on w which lets us choose a canonical value of type w, such as Monoid. -Brent