-
Notifications
You must be signed in to change notification settings - Fork 41
Add various instances for NullOrUndefined
#52
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
Conversation
paf31
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you please add these for the Null and Undefined types as well?
| derive instance newtypeNullOrUndefined :: Newtype (NullOrUndefined a) _ | ||
|
|
||
| instance showNullOrUndefined :: (Show a) => Show (NullOrUndefined a) where | ||
| show x = "NullOrUndefined " <> show (unwrap x) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you please wrap this output in parens?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done for all instances, could you confirm it's correct?
| instance showNullOrUndefined :: (Show a) => Show (NullOrUndefined a) where | ||
| show x = "NullOrUndefined " <> show (unwrap x) | ||
|
|
||
| instance eqNullOrUndefined :: (Eq a) => Eq (NullOrUndefined a) where |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You could just derive the Eq and Ord instances.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated
|
Thanks for working on this! |
56717ef to
aac134b
Compare
|
Ready for review |
|
Travis says
although I'm not sure why it's an error and not a warning. Anyway, the code looks good, thanks! Could you please just fix up the imports? |
It's because we use |
|
👍 Ah, that sounds like a good idea, thanks. |
|
Thanks! |
Add various useful instances for
NullOrUndefined,NullandUndefined, such asOrd,Eq,ShowandNewtype.Fixes #51