Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
newtype vs data in haskll
Prelude> data D = D Int
Prelude> let f (D i) = "ok"
Prelude> f undefined
"*** Exception: Prelude.undefined
Prelude> newtype D = D Int
Prelude> let f (D i) = "ok"
Prelude> f undefined
"ok"
@mattfenwick

This comment has been minimized.

Show comment Hide comment
@mattfenwick

mattfenwick Nov 26, 2012

Just ran in to the same issue and got the same result as you ... took forever to figure out what the issue was. Thanks for posting this.

I found this link from this StackOverflow comment.

Just ran in to the same issue and got the same result as you ... took forever to figure out what the issue was. Thanks for posting this.

I found this link from this StackOverflow comment.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment