Opened 4 years ago

Closed 4 years ago

#8807 closed bug (fixed)

Variable constraints not handled properly in TH

Reported by: goldfire Owned by: goldfire
Priority: normal Milestone: 7.10.1
Component: Template Haskell Version: 7.9
Keywords: Cc:
Operating System: Unknown/Multiple Architecture: Unknown/Multiple
Type of failure: None/Unknown Test Case:
Blocked By: Blocking:
Related Tickets: Differential Rev(s):
Wiki Page:


When I compile

{-# LANGUAGE TemplateHaskell, ConstraintKinds #-}

module Scratch where

import Data.Proxy

foo :: $( [t| a b => Proxy a -> b -> b |] )
foo = undefined

I get

    Illegal type constructor or class name: ‛a’
    When splicing a TH type:
      forall a_0 b_1 . a_0 b_1 => Data.Proxy.Proxy a_0 -> b_1 -> b_1
    In the splice: $([t| a b => Proxy a -> b -> b |])

Change History (2)

comment:1 Changed 4 years ago by Richard Eisenberg <eir@…>

In 98b6756b09194352aa2ccfbb624992150a7a3520/ghc:

Fix #8807.

It turns out that the enhanced repPred function in DsMeta assumed
that the head of any constraint would be a tycon. This assumption
is false. Happily, the solution involved *deleting* code. I
just removed repPred in favor of repTy, and added the HsEqTy case
to repTy, where it should be anyway.

comment:2 Changed 4 years ago by goldfire

Resolution: fixed
Status: newclosed
Note: See TracTickets for help on using tickets.