Created
September 10, 2012 23:41
-
-
Save keigoi/3694857 to your computer and use it in GitHub Desktop.
weaker kind-inference in ghc 7.4.1
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{-# LANGUAGE ScopedTypeVariables, KindSignatures #-} | |
import Data.Typeable | |
innerTypeOf :: Typeable a => t a -> TypeRep | |
innerTypeOf (x :: t a) = typeOf (undefined :: a) -- fail | |
-- giving a kind explicitly will do | |
-- innerTypeOf (x :: t (a:: *)) = typeOf (undefined :: a) -- ok | |
main = print (innerTypeOf ([1]::[Int])) -- print 'Int' | |
{- | |
$ ghc --version | |
The Glorious Glasgow Haskell Compilation System, version 7.4.1 | |
$ ghc --make Kind.hs | |
[1 of 1] Compiling Main ( Kind.hs, Kind.o ) | |
Kind.hs:5:34: | |
Expecting an ordinary type, but found a type of kind k_agq | |
In an expression type signature: a | |
In the first argument of `typeOf', namely `(undefined :: a)' | |
In the expression: typeOf (undefined :: a) | |
-} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment