This declaration doesn't work:
data Identity a where {Identity :: (->) a (Identity a)}
How to fix this?
At least as of GHC 7.8, if you turn on GADT support, then your code typechecks and does what you'd expect:
{-# LANGUAGE GADTs #-}
data Identity a where {Identity :: (->) a (Identity a)}
resulting in:
GHCi, version 7.8.3: http://www.haskell.org/ghc/ :? for help
Loading package ghc-prim ... linking ... done.
Loading package integer-gmp ... linking ... done.
Loading package base ... linking ... done.
[1 of 1] Compiling Main ( foo.hs, interpreted )
Ok, modules loaded: Main.
λ» :i Identity
data Identity a = Identity a -- Defined at foo.hs:2:1
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With