Open ghost opened 9 years ago
Your slicing lens is very interesting; we have, I think, replaced much of our machinery with a lens-based approach in the upcoming release of vinyl (#66). The AltRec
newtype is also cool. I'd be interested in integrating something like your extra machinery for those functors as well, though I wonder if it is possible to do it without a type class... In new-vinyl, I think that rcompdist
is called rtraverse1
or something, btw.
Anyway, nice work! I don't think I want to merge anything into the present version of vinyl at the moment, since I am trying to get the next version released (which changes a lot to simplify how it works and how you use it). But if you have time, after the new-vinyl release, I'd be delighted to accept changes like the ones discussed above. Thanks!
Okay, I uploaded it as vinyl-utils then: http://hackage.haskell.org/package/vinyl-utils-0.0.0.0 Many of the type classes indeed weren't necessary after all, so I got rid of them: http://hub.darcs.net/mjm/vinyl-utils/browse/src/Data/Vinyl/Utils/Operator.hs Btw. how to properly use foldRec? I feel it should be possible to express &&\ and ||\ in terms of it, and I was trying something in the lines of http://pastebin.com/58Zv00hv but I can't get it to typecheck, GHC can't deduce the proper FoldRec instance.
I have never used FoldRec, so I am not sure... Fwiw, I think it may not be included in the 0.5 version of Vinyl mainly since I didn't really understand it, and its type seemed kind of strange.
Congratulations on Vinyl 0.5! I have updated my -utils to work with the new version. Though I think I need to pester you a little more: while I understand that you might not want a Transformers dependency, why do you have your own Const in Vinyl.Functor when it's already in Control.Applicative?
Also, I came up with some way to bring back generic record field (de)construction using a type class: http://pastebin.com/saVHAnNG Unfortunately my version doesn't work with TH generated singletons (requires additional type parameter) and also requires longer type signatures (perhaps some rearranging of associated types could help).
This is slightly tangential, but related to recent very minor changes: please keep the custom Identity
in Vinyl as it prints out nicely :)
Const
is that we needed it to be kind polymorphic; as @acowley notes, we have a custom Identity
because it prints without noise (I think that's why we did it, at least).Cheers!
We needed our own Identity
to avoid an orphan Show
instance when transformers
inexplicably lacked one. I don't see how having custom versions of these hurts things at all other than the red herring of a duplication code smell.
Ah right! Yes, the only real downside to having the custom types is IMO that people might get confused when they try to use Vinyl with the standard ones, but because of the non-kind-polymorphic definitions in transformers and the lack of a Show instance for Identity, it is unfortunately inevitable.
Okay, at first I thought that it might stand in the way of distributing any of these constructors with a Rec, but now that I think about it I can't see any sensible use case of this.
I wrote some utilities for Vinyl, namely:
Should I release them as a separate package, or would you like to include it in Vinyl?