Skip to content
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

maybe: change type of S.Nothing from ‘-> Maybe a’ to ‘Maybe a’ #225

Merged
merged 1 commit into from Jul 3, 2016

Conversation

davidchambers
Copy link
Member

Initially, S.Nothing existed both to create the Nothing value and to support R.is(S.Nothing). S.Nothing is no longer a constructor function, and we now have S.isNothing to answer the question of whether a given value of type Maybe a is Nothing. This means S.Nothing can now be the Nothing value, improving Haskell correspondence:

Nothing Just
Sanctuary, before S.Nothing() S.Just(42)
Sanctuary, after S.Nothing S.Just(42)
Haskell Nothing Just 42

Can anyone think of a problem with this change?


This evening I realized for the first time that “nothing” is comprised of “no” and “thing”. I now think Haskell should have gone with data Maybe a = Thing a | Nothing. ;)

};

//# Maybe.empty :: -> Maybe a
//.
//. Returns a Nothing.
//. Returns Nothing.
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I ❤️ getting to remove “a” here: conceptually there's a single Nothing value.

@svozza
Copy link
Member

svozza commented Jun 6, 2016

LGTM.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants