[Haskell-cafe] Pulling an applicative/apply out of a record

Tom Ellis tom-lists-haskell-cafe-2013 at jaguarpaw.co.uk
Sun Feb 7 10:17:46 UTC 2016


On Sun, Feb 07, 2016 at 02:25:41AM -0500, Tyson Whitehead wrote:
> RecordF (f Type1) (f Type2) ... -> (f Type1, f Type2, ....)
> -> f (Type1, Type2, ...) -> f (Record Type1 Type2 ...)
> 
> I can't seem to find any uncurried zip implementations for arbitrarily
> large tuples (or any other way to do this without writing the
> boilerplate).  Am I missing something?  Is there a better way to do this?

I would call this a multi-typed 'Data.Traversable.sequence'.

Data.Profunctor.Product.TH generates this (in fact something slightly more
general that works for ProductProfunctors, not just Applicatives).

Currently it only works for fully polymorphic record types, but we could
tweak it so it so it's a bit more general.

Tom



More information about the Haskell-Cafe mailing list