What is the story behind the type of undefined?
David Feuer
david.feuer at gmail.com
Sun Feb 1 18:54:56 UTC 2015
If I define
{-# LANGUAGE MagicHash #-}
g :: Int# -> Int
g 3# = 3
myUndefined = undefined
then this gives a sensible type error about a kind mismatch:
usual :: Int
usual = g myUndefined
but this, oddly enough, compiles:
peculiar :: Int
peculiar = g undefined
GHCi and the definition in GHC.Error agree that
undefined :: a
So why am I allowed to use it as a type of kind #?
More information about the ghc-devs
mailing list