Created
March 4, 2015 19:46
-
-
Save hdgarrood/93b2d8b83d83a889d9b2 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module Coercible where | |
foreign import unsafeCoerce | |
"function unsafeCoerce(x) { return x }" :: forall a b. a -> b | |
class Coercible a b | |
coerce :: forall a b. (Coercible a b) => a -> b | |
coerce = unsafeCoerce | |
-- Coercible is an equivalence relation | |
instance reflexiveCoercible :: Coercible a a | |
instance symmetricCoercible :: (Coercible a b) => Coercible b a | |
instance transitiveCoercible :: (Coercible a b, Coercible b c) => Coercible a c | |
instance coercibleF :: (Coercible a b) => Coercible (f a) (f b) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment