Haskell Foldable Wats

Edward Kmett ekmett at gmail.com
Wed Feb 24 15:42:26 UTC 2016


You can wish for such an instance all you want, but it can't exist.

The definition of Functor is forced on you by the a combination of the
laws, and the way the type system works. You can't have this "other"
instance even if you want it, even if the instance we have today wasn't
there.

(,) e :: * -> *

That is a legal choice of 'f' for

class Functor f where
   fmap :: (a -> b) -> f a -> f b

We don't (and can't) have a "type lambda" that lets you talk about

instance Functor (\x -> (x,x))

With it instance resolution would go to hell.

There is only one solitary degree of freedom in the design, which comes
down to whether or not the instance should use a strict or a lazy pattern
match on the tuple.

-Edward

On Wed, Feb 24, 2016 at 10:28 AM, Kosyrev Serge <_deepfire at feelingofgreen.ru
> wrote:

> Nathan Bouscal <nbouscal at gmail.com> writes:
> > As opposed to what other instance??
>
> I expect there to be N similarly-structured Functor instances for a
> N-ary tuple.
>
> --
> с уважениeм,
> Косырев Сергей
> _______________________________________________
> Libraries mailing list
> Libraries at haskell.org
> http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/libraries/attachments/20160224/5965335c/attachment.html>


More information about the Libraries mailing list