Skip to content

Instantly share code, notes, and snippets.

@monadplus
Created January 28, 2020 13:42
Show Gist options
  • Save monadplus/e4cd788c3ca8675d7c84a8f755065205 to your computer and use it in GitHub Desktop.
Save monadplus/e4cd788c3ca8675d7c84a8f755065205 to your computer and use it in GitHub Desktop.
Incoherent: use it with care
class Foo a where
foo :: a -> Int
instance Foo Char where
foo _ = 2
instance {-# INCOHERENT #-} Foo a where
foo _ = 3
incoherent :: Char -> Bool
incoherent x = foo x /= foo' x
where
foo' :: (Foo a) => a -> Int
foo' = foo
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment