Skip to content

Template Haskell splicing drops lots of type arguments

The conversion functions (in the Convert module) drop type arguments in various places.

Here are two examples:

data T a b c = Mk a b c

bar :: $( return $ AppT (InfixT (ConT ''Int) ''T (ConT ''Bool)) (ConT ''Double) )
bar = Mk 5 True 3.14

This correct code leads to an error

Expecting one more argument to ‘T Int Bool’

because the Double is forgotten.

Similarly,

baz :: $( return $ AppT (ParensT (ConT ''Maybe)) (ConT ''Int) )
baz = Just 5

fails because baz :: (Maybe) isn't valid.

On the other hand,

frob :: forall (a :: $( [t| * Int |] )). a -> a
frob x = x

is spuriously accepted, because GHC has forgotten about the Int argument.

Trac metadata
Trac field Value
Version 8.4.3
Type Bug
TypeOfFailure OtherFailure
Priority normal
Resolution Unresolved
Component Template Haskell
Test case
Differential revisions
BlockedBy
Related
Blocking
CC
Operating system
Architecture
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information