Proposal: Add conspicuously missing Functor instances for tuples

Ryan Scott ryan.gl.scott at gmail.com
Mon Jan 18 20:46:20 UTC 2016


A surprising amount has already been written on the topic of
Functor/Foldable/Traversable instances (both for and against) for
tuples, so I feel it's fair to link them here:

* FTP dangers: http://nattermorphisms.blogspot.com/2015/02/ftp-dangers.html
* Either and (,) in Haskell are not arbitrary:
http://bitemyapp.com/posts/2015-10-19-either-is-not-arbitrary.html
* Foldable for non-Haskellers: Haskell's controversial FTP proposal:
http://tojans.me/blog/2015/10/13/foldable-for-non-haskellers-haskells-controversial-ftp-proposal/#update:916dcbca10117e99a7571170d02b3db4
* The Not-A-Wat in Haskell:
https://www.youtube.com/watch?v=87re_yIQMDw&feature=youtu.be

Ryan S.

On Mon, Jan 18, 2016 at 3:44 PM, Christopher Allen <cma at bitemyapp.com> wrote:
> I've addressed this here:
>
> http://bitemyapp.com/posts/2015-10-19-either-is-not-arbitrary.html
>
> The thousand-papercuts opposition to typeclass instances on the premise that
> a Functor for (a, b, c) maps over the final type not making sense is a
> rejection of how higher kinded types and typeclasses work together. This is
> natural and predictable if one bothers to explain it.
>
>
> On Mon, Jan 18, 2016 at 2:42 PM, Henning Thielemann
> <lemming at henning-thielemann.de> wrote:
>>
>>
>> On Mon, 18 Jan 2016, David Feuer wrote:
>>
>>> Actually, I currently get a much worse error message:
>>>
>>> Prelude> fmap (+1) (1,2,3)
>>>
>>> <interactive>:2:1:
>>>    Non type-variable argument in the constraint: Functor ((,,) t t)
>>>    (Use FlexibleContexts to permit this)
>>>    When checking that ‘it’ has the inferred type
>>>      it :: forall b t t1.
>>>            (Functor ((,,) t t1), Num b, Num t, Num t1) =>
>>>            (t, t1, b)
>>>
>>> That there is a *lousy* error message.
>>
>>
>> indeed
>>
>>
>>> I understand that there are newcomers who struggle to understand the
>>> difference between tuples and lists; I don't think that's a good
>>> enough reason to omit a good and valid instance.
>>
>>
>> I would not qualify myself as a newcomer. For me these instances are a
>> problem, not a help.
>> _______________________________________________
>> Libraries mailing list
>> Libraries at haskell.org
>> http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries
>>
>
>
>
> --
> Chris Allen
> Currently working on http://haskellbook.com


More information about the Libraries mailing list