Skip to content

(a :: (k :: Type)) is too exotic for Template Haskell

On GHC 8.0.1 or later, GHC will choke on this code:

{-# LANGUAGE TemplateHaskell #-}
{-# LANGUAGE TypeInType #-}
module Bug where

import Data.Kind
import Data.Proxy

$([d| f :: Proxy (a :: (k :: Type))
      f = Proxy
    |])
GHCi, version 8.2.0.20170522: http://www.haskell.org/ghc/  :? for help
Loaded GHCi configuration from /home/rgscott/.ghci
[1 of 1] Compiling Bug              ( Bug.hs, interpreted )

Bug.hs:8:3: error:
    Exotic form of kind not (yet) handled by Template Haskell
      (k :: Type)
  |
8 | $([d| f :: Proxy (a :: (k :: Type))
  |   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^...

I don't think this would be too hard to support, though. I'll take a shot at fixing this.

Trac metadata
Trac field Value
Version 8.0.1
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