Skip to content

Instantly share code, notes, and snippets.

@keigoi keigoi/Kind.hs
Created Sep 10, 2012

What would you like to do?
weaker kind-inference in ghc 7.4.1
{-# 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 )
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
You can’t perform that action at this time.