VinylRecords/Vinyl — pull request #29 by conklech (2013-12-17 01:48:29+00:00)
Title: Implement `ApFunctor` and `ApApplicative` from #25

This branch implements all the functionality from #25. I've tested it a little, but for instance I haven't verified that the instances obey the `ApFunctor` and `ApApplicative` laws.

- As @pthariensflame recommended, rename `Apply` to `ApApply` and use that naming scheme throughout
- Add `ApFunctor`, and add it as superclass constraint to the other classes
- Add `ApPointed` and `ApApplicative` as a `ConstraintKinds` type synonym. This hadn't been discussed in #25, but was necessary to...
- Implement `apEmpty` and `<<|>>` using `ApApplicative` and the underlying `Alternative` instance. This does not need its own class.
- Generalize `Dist` to `ApTraversable`, mirroring `Traversable`.
- Restore `run` function ala `vinyl-1.x`, using `ApTraversable`
- Implement `Rec` instances of all these classes.

As of conklech@98822ca, GHC seems to produce efficient Core in simple uses of `<<*>>` and `<<$>>`. For instance, `(Nothing :& Just x :& RNil) <<|>> (Just a :& Nothing :& RNil)` gets optimized to the equivalent of `(Just a :& Just x :& RNil)`. Splitting the instance declarations was necessary for that to work. Unfortunately, the split instances make the Haddocks (even) messier.

I left `ApTraversable1` commented out to avoid depending on `semigroupoids`.

I think the only remaining issue on this branch is that the documentation could (always) be better. I could work up some of my examples from #25 into a blog post or something if that seems like a good idea.