Haskell Foldable Wats

Andreas Abel andreas.abel at ifi.lmu.de
Thu Feb 18 14:28:25 UTC 2016

+1.  Use of tuples is highly discourageable, except for returning 
multiple arguments from a function.  For everything else, roll your own 
datatype, to give the reader of your code some semantics, and to 
introduce more redundancy to avoid erros.

I see no point in Functor or Foldable for tuples.

I also do not see why (a,a) could not be a container of exactly two 
elements, as opposed to current GHC which insists it is a container of 
exactly one element.  (Case for the mental institution, I'd say.)


On 18.02.2016 14:04, Henrik Nilsson wrote:
> Hi,
> On 02/18/2016 12:41 PM, Manuel Gómez wrote:
>>> >And whenever I have wanted to map on tuple fields (which I do from
>>> >time to time), I most certainly want the ability to map on any field.
>> Anyone with a couple of decades of Haskell experience ought to
>> understand that the desire to map on any field of a record cannot be
>> served by a typeclass such as Functor.
> Yes, that's exactly my point: functor is not the right tool. So
> why make tuples instances of functor in the first place?
> And yes, there is arguably an asymmetry of sorts in having to pick an
> order among type constructor arguments. But that does not change the
> fact that there is symmetry in having a projection function for
> each field. So why even entertain a notion of mapping that
> doesn't grant the same privileges to all fields?
> Might be useful in some specialist applications, but certainly not
> what I, at least, would consider particularly useful.
> Best,
> /Henrik

Andreas Abel  <><      Du bist der geliebte Mensch.

Department of Computer Science and Engineering
Chalmers and Gothenburg University, Sweden

andreas.abel at gu.se

More information about the Libraries mailing list