[Haskell-cafe] Factoring into type classes

Lennart Augustsson lennart at augustsson.net
Mon Jan 19 10:20:26 EST 2009


The desugaring of (, a) would involve some type level lambda, and
that's not something that is available (yet).

  -- Lennart

On Mon, Jan 19, 2009 at 1:49 PM, Holger Siegel <holgersiegel74 at yahoo.de> wrote:
> Am Montag, den 19.01.2009, 14:47 +0100 schrieb Daniel Fischer:
>> Am Montag, 19. Januar 2009 14:31 schrieb Antoine Latter:
>> > 2009/1/19 Luke Palmer <lrpalmer at gmail.com>:
>> > > As a side curiosity, I would love to see an example of any data structure
>> > > which has more than one Functor instance.  Especially those which have
>> > > more than one useful functor instance.
>> >
>> > (,)  ?
>> >
>> > -Antoine
>>
>> Wrong kind. And
>> (,) a
>> has only one useful instance.
>
>
> What about
>
> instance Functor ((,) a) where
>        fmap f (x,y) = (x, f y)
>
> and
>
> instance Functor (, a) where
>        fmap f (x, y) = (f x, y)
>
> ? Of course, the latter is not legal Haskell. But if it was, then it
> might be useful.
>
> Is there any way to declare this Functor instance, possibly with some
> GHC extensions?
>
>
>
> _______________________________________________
> Haskell-Cafe mailing list
> Haskell-Cafe at haskell.org
> http://www.haskell.org/mailman/listinfo/haskell-cafe
>


More information about the Haskell-Cafe mailing list