Join GitHub today
GitHub is home to over 31 million developers working together to host and review code, manage projects, and build software together.
Sign upIdea: Coercible trait #1896
Comments
This comment has been minimized.
This comment has been minimized.
|
It has been proposed multiple times (originally by me): #270 |
Centril
added
T-lang
T-libs
labels
Feb 23, 2018
This comment has been minimized.
This comment has been minimized.
|
Closing as duplicate. |
Centril
closed this
Feb 23, 2018
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
DemiMarie commentedFeb 11, 2017
GHC implements a two-paramenter type class called
Coercibleand a corresponding safe functioncoerce, with the following types:This allows the following:
Without coerce, this would require
unsafeCoerce(GHC's version ofmem::transmute) or an O(n) mapping over the list.In Rust, the same problem can arise. It would be nice to support something like this.