[<<][haskell][>>][..]

Wed May 30 13:21:40 EDT 2018

## Structure preserving applicatives? (Zippable?)

Is there a way to constrain an applicative such that it is
structure-preserving, in the same way that fmap has to be?
E.g. List has a very annoying cross product Applicative. ZipList is
the way around that.
How to say I want it to be the same shape?
What is actually the constraint I'm making?
Maybe the more important question: Why am I using an applicative
functor in a way that this matters?
Edit: actually, in this case ('next' in Seq.hs), the only use can be
replaced by toList + zip.
In fixMem I still need to use liftA2.
But if it is in a monad, maybe application helps?
I don't understand why this is so hard to resolve. Why can't a
functor have a size and a canonical list representation?
https://stackoverflow.com/questions/31143239/zippable-class-for-haskell
Representable functor
http://hackage.haskell.org/package/adjunctions-4.2.1/docs/Data-Functor-Rep.html#v:liftR2
https://en.wikipedia.org/wiki/Representable_functor
I don't quite understand it.
ZipList is not an instance?
Maybe look at what ZipList is an instance of?
Maybe it is Alternative?
Which is a Monoid only if the containee is a monoid right?
List is also Alternative, so not what I'm looking for.
So basically, this is a little to dense.. For now I don't need a
solution. Errors against non-zipping applicatives will be caught at
runtime.
So ZipList is actually "dirty" because (liftA2 f) is not total.
EDOT: Actually ziplists do truncate, so it is total.
The solution is probably to use Rep?

[Reply][About]

[<<][haskell][>>][..]