Skip to content

Template Haskell : getQ and putQ doesn't work

Functions getQ and putQ in the module Language.Haskell.TH.Syntax do not work.

Following code is an example of this problem. The variable x should be (Just B), but x is Nothing.

{-# LANGUAGE TemplateHaskell #-}
module X where
import Language.Haskell.TH
import Language.Haskell.TH.Syntax
do
  putQ (100 :: Int)
  x <- getQ :: Q (Maybe Int)

  -- It should print "Just 100" but "Nothing"
  runIO $ print x
  return []

As a result, I get following output on compile.

$ ghc -fforce-recomp X.hs
[1 of 1] Compiling X                ( X.hs, X.o )
Nothing
Trac metadata
Trac field Value
Version 7.10.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