Join GitHub today
GitHub is home to over 36 million developers working together to host and review code, manage projects, and build software together.
Sign upMore general type signatures for `makeTraversals` #12
Comments
DanBurton
added a commit
that referenced
this issue
Feb 28, 2015
This comment has been minimized.
This comment has been minimized.
|
I finally put the elbow grease into making this happen. It's still largely untested, but per business-as-usual in Haskell, once it compiled, it seemed to work. You can see for yourself that the traversals generated in examples/traversal-test.lhs are more general now:
Kindly test this out a little when you can. Meanwhile, I'll review, clean up the code a bit, and maybe even add a test suite. Once I hear back from you ( @Gabriel439 ) I'll release the new version. |
This comment has been minimized.
This comment has been minimized.
|
I just gave it a test drive and it works great! I tried it out with my |
This comment has been minimized.
This comment has been minimized.
|
Uploaded the new version: 0.4.1.0. Cheers! |
Gabriel439 commentedJan 11, 2015
Right now I'm working on a package for exhaustive pattern matching using
Traversals (you can find the code here). However, for the trick to work with auto-generatedTraversals I need them to have more general types.For example, let's assume that we were to generate
Traversals for theEithertype:This would generate something like this:
However, I actually need the following more general types, which requires complicating the implementation:
The type signatures are not the complicated part because they can be omitted (the inferred types would still be correct). What makes this more complex is that you can no longer implement the
Traversalin terms of two cases (the matching constructor and the fallback). Instead, you must now provide a case for every constructor.This is not urgent, because I can work around this by using the
makePrismsfunction fromControl.Lens.TH, which does produce the fully general type signatures.