Closed sheaf closed 3 years ago
Thanks; I'm still in the process of figuring out how to use the library.
I just added a constrained traversal as I found that very useful with the generic-lens
library. In this case it gives a way of traversing the fields of a record with a type-changing update:
traverseC
:: ( TraversalC c as bs, Applicative f )
=> ( forall (l :: Symbol) a b. (KnownSymbol l, c l a b) => FldProxy l -> a -> f b )
-> Rec as -> f ( Rec bs )
i.e. at field label l
, use the typeclass instance c l a b
to perform a type-changing update of type a -> f b
.
This is quite general and can be used to write zipWith
-style functions for instance.
I still need to test some of this a bit more though.
RecApply
to allow the type class instance to depend on the field label.Has
to a class newtype to allow partial application (this involved changing the order of arguments to facilitate the most common partial application).RecApply
to rewrite theEq
andNFData
instances (obviating the need for custom type classes for those).RecApply
to implement aSemigroup
instance.Monoid
instance.KeyDoesNotAppear
constraint fromunsafeRCons
(#29).AllowAmbiguousTypes
.