Opened 3 years ago

Closed 3 years ago

Last modified 3 years ago

#13781 closed bug (fixed)

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

Reported by: RyanGlScott Owned by: RyanGlScott
Priority: normal Milestone: 8.4.1
Component: Template Haskell Version: 8.0.1
Keywords: TypeInType Cc:
Operating System: Unknown/Multiple Architecture: Unknown/Multiple
Type of failure: GHC rejects valid program Test Case: T13781
Blocked By: Blocking:
Related Tickets: Differential Rev(s): Phab:D3627
Wiki Page:


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  :? 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.

Change History (5)

comment:1 Changed 3 years ago by RyanGlScott

Owner: set to RyanGlScott

comment:2 Changed 3 years ago by RyanGlScott

Differential Rev(s): Phab:D3627
Status: newpatch

comment:3 Changed 3 years ago by Ben Gamari <ben@…>

In 9a3ca8de/ghc:

Support signatures at the kind level in Template Haskell

`repNonArrowKind` was missing a case for `HsKindSig`, which this
commit adds. Fixes #13781.

Test Plan: make test TEST=T13781

Reviewers: goldfire, austin, bgamari

Reviewed By: goldfire

Subscribers: rwbarton, thomie

GHC Trac Issues: #13781

Differential Revision:

comment:4 Changed 3 years ago by bgamari

Milestone: 8.4.1
Resolution: fixed
Status: patchclosed

comment:5 Changed 3 years ago by bgamari

Test Case: T13781
Note: See TracTickets for help on using tickets.