Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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
You can’t perform that action at this time.