Skip to content

TH typechecking regression

The 7.0 branch (and HEAD) behaves differently to 7.0.1 on this modules:

{-# LANGUAGE TemplateHaskell #-}
module Foo where

import Language.Haskell.TH

x :: Int
x = let args = [| show $(varE (mkName "x")) |]
    in undefined
  1. 0.1 accepted it, while we now get:
Foo.hs:7:19:
    Ambiguous type variable `a0' in the constraint:
      (Show a0) arising from a use of `show'
    Probable fix: add a type signature that fixes these type variable(s)
    In the Template Haskell quotation [| show ($(varE (mkName "x"))) |]
    In the expression: [| show ($(varE (mkName "x"))) |]
    In an equation for `args': args = [| show ($(varE (mkName "x"))) |]

This affects these packages:

CCA
Printf-TH
grammar-combinators
hacanon-light
hamlet
rowrecord
th-lift
web-routes-quasi
Trac metadata
Trac field Value
Version 7.0.1
Type Bug
TypeOfFailure OtherFailure
Priority highest
Resolution Unresolved
Component Compiler (Type checker)
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