Haskell Foldable Wats

amindfv at gmail.com amindfv at gmail.com
Wed Feb 24 18:11:54 UTC 2016


I don't know what this means -- can you elaborate?

(What I'm proposing is, since there is a sizeable number of people on both sides of the issue who don't seem to be coming closer to an agreement, we bring a vote *to the users* on whether to provide Foldable/Traversable instances for tuples of size 2 and greater. If users say they're useful, we keep/add 'em. If they find them confusing/not useful, we remove/don't add 'em)

Tom


> El 24 feb 2016, a las 12:27, Chris Allen <cma at bitemyapp.com> escribió:
> 
> You can't not-include the instances because we'll just end up with orphans so that's not cricket I think.
> 
>> On 02/24/2016 11:17 AM, amindfv at gmail.com wrote:
>> It seems like very few people are changing their minds, after a lot of discussion -- maybe it's time to agree to disagree, in the form of a vote on whether to include the tuple instances.
>> 
>>      If so, I'd think we'd want to come to the users with a discussion of both sides and a poll, a la FTP.
>> 
>> Tom
>> 
>> 
>> El 24 feb 2016, a las 11:38, David Feuer <david.feuer at gmail.com> escribió:
>> 
>>> 
>>> 
>>> On Wed, Feb 24, 2016 at 11:22 AM,                 Kosyrev Serge <_deepfire at feelingofgreen.ru> wrote:
>>>> 
>>>> Are you also saying that this cannot be resolved by some kind of a
>>>> type families-based type-level 'flip'?
>>> 
>>> It really can't, no. You can define
>>> 
>>> type family FlipF f a b where
>>>   FlipF f a b = f b a
>>> 
>>> but FlipF, being a type family, is not first-class. You can't make any instances whatsoever for FlipF f a -- you'll probably get an error about a partially applied type family. What you *can* do is make a Flip newtype:
>>> 
>>> newtype Flip f a b = Flip {unflip :: f b a}
>>> 
>>> This behaves perfectly:
>>> 
>>> instance Bifunctor f => Functor (Flip f a) where
>>>   fmap f = Flip . first f . unflip
>>> instance Profunctor f => Contravariant (Flip f a) where
>>>   contramap f = Flip . lmap f . unflip
>>> instance Bifunctor f => Bifunctor (Flip f) where
>>>   bimap f g (Flip x) = Flip (bimap g f x)
>>> _______________________________________________
>>> Libraries mailing list
>>> Libraries at haskell.org
>>> http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries
>> 
>> 
>> _______________________________________________
>> Libraries mailing list
>> Libraries at haskell.org
>> http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries
> 
> _______________________________________________
> 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/6e88a5ff/attachment.html>


More information about the Libraries mailing list