Skip to content

Template Haskell confused by operator fixity

Reported by JCAB

{-# LANGUAGE TemplateHaskell #-}
module MkData where

import Language.Haskell.TH
import Language.Haskell.TH.Syntax

op a b = a + b

decl = [d| func = 0 `op` 3 |]

Works with 6.8.3, but with the 6.10 beta, it dies with the strange message

C:\Users\JCAB\Haskell\THTest>ghc --make main.hs
[1 of 2] Compiling MkData           ( MkData.hs, MkData.o )
attempting to use module `main:MkData' (.\MkData.hs) which is not loaded

When looking up op, GHC doesn't find the fixity correctly. (SLPJ comment: having looked at the code in RnEnv.lookupFixity I can't see how 6.8.3 works!)

Trac metadata
Trac field Value
Version 6.8.3
Type Bug
TypeOfFailure OtherFailure
Priority normal
Resolution Unresolved
Component Compiler
Test case
Differential revisions
BlockedBy
Related
Blocking
CC jcab.lists@JCABs-Rumblings.com
Operating system Unknown
Architecture Unknown
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information