[Haskell-cafe] Pointless functors
Brent Yorgey
byorgey at seas.upenn.edu
Fri Mar 13 11:10:26 EDT 2009
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
More information about the Haskell-Cafe
mailing list