-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add Generic instance for SinkableK #31
Conversation
23c3594
to
ad76a10
Compare
Despite 20+ uses of I am NOT removing Also I have a feeling that the code will become way simple with another step or two in the generalization direction. In particular, the fact that patterns rely on two type parameters for inner and outer scopes is super annoying to deal with. Also the separation between terms and patterns feels too artificial: patterns may have terms in them! |
Sinkable
CoSinkable
UnifiablePattern
SinkableK
generalizes bothSinkable
andCoSinkable
(exceptwithPattern
)f n1 n2 .. nK
is treated as a generalized binder with variables/terms in scopesn1
,n2
, ...nK
SinkableK
(coveringsinkabilityProof
andcoSinkabilityProof
)HasNameBinders
generalizes access to nestedNameBinder
s, which makes genericwithPattern
possible!GValidNameBinders
that prevents misuse mentioned below and (sometimes) provides nice error messages. In particular, the following example shows good vs bad constructors in a user-defined pattern:Current implementation is "slightly" unsafe, but should be fine in practice 🤞free-foil/haskell/free-foil/src/Control/Monad/Foil/Internal.hs
Lines 1215 to 1234 in 02a8d1b
Obsolete plan:
Add an internalGSinkable
class and use it for defaultsinkabilityProof
implementationMakeGSinkable
work for GADTs