Skip to content

Instantly share code, notes, and snippets.

@luqui
Created February 13, 2013 22:24
Show Gist options
  • Save luqui/4948933 to your computer and use it in GitHub Desktop.
Save luqui/4948933 to your computer and use it in GitHub Desktop.
Type unsoundness in Haskell
{-# LANGUAGE GeneralizedNewtypeDeriving, TypeFamilies #-}
-- related to http://hackage.haskell.org/trac/ghc/ticket/1496
type family F a
type instance F Int = Int
type instance F X = Int -> Int
class Fable a where
fify :: a -> F a
instance Fable Int where
fify = id
newtype X = X Int
deriving Fable
main = print (fify (X 0) 0)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment