-
Notifications
You must be signed in to change notification settings - Fork 147
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
Generalize Undefined
to work with non-errors too
#748
Comments
It's somewhat specific to products of a single type though... how do you generalize this to e.g. tuples? |
I'm not sure I understand what you're saying. The implementation for a tuple would be something like: instance (Undefined a, Undefined b) => Undefined (a, b) where
-- lazify ~(a, b) = (lazify a, lazify b) ?
lazify ab =
( let (a, _) = ab in lazify a
, let (_, b) = ab in lazify b
) |
So what's the |
class Undefined a where
lazify :: a -> a ? Could you just explain what issues you're seeing? |
I don't see what the benefit is of having:
over
|
Ah right. It allows your to implement |
To be more specific, |
Does that make sense @christiaanb? |
Yeah, that makes sense |
@christiaanb a potential use case is when you have
will produce
which will give you back the structure. |
deepErrorX
builds the structure/spine of a datatype and puts an error at its "core". This can be generalized such that it "lazyfies" a given type instead. Consider:We could build
lazify
(for the lack of a better name) to achieve:deepErrorX
can now be defined as:The text was updated successfully, but these errors were encountered: