Ticket #3600 (closed merge: fixed)
Template Haskell mis-coverting empty list to empty string
| Reported by: | simonpj | Owned by: | igloo |
|---|---|---|---|
| Priority: | normal | Milestone: | 6.12.1 |
| Component: | Template Haskell | Version: | 6.10.4 |
| Keywords: | Cc: | aslatter@… | |
| Operating System: | Unknown/Multiple | Architecture: | Unknown/Multiple |
| Type of failure: | Difficulty: | Unknown | |
| Test Case: | th/T3600 | Blocked By: | |
| Blocking: | Related Tickets: |
Description
Antoine Latter aslatter@… writes: the program Demo.hs compiles on 6.10, but not on 6.12rc1. The output --ddump-splices for 6.10:
Demo.hs:1:0:
Demo.hs:1:0: Splicing declarations
test
======>
Demo.hs:6:2-5
myFunction[aLQ] = Demo2.testFun []
Ok, modules loaded: Demo2, Main.
In 6.12rc1:
Demo.hs:1:0:
Demo.hs:1:0: Splicing declarations
test
======>
Demo.hs:6:2-5
myFunction[aNX] = testFun ""
Demo.hs:6:2:
Couldn't match expected type `[Char]' against inferred type `Char'
Expected type: [String]
Inferred type: [Char]
In the first argument of `testFun', namely `""'
In the expression: testFun ""
Failed, modules loaded: Demo2.
The code is short:
---------- Demo.hs ---------------
{-# LANGUAGE TemplateHaskell #-}
module Demo where
import Demo2
$(test)
---------- Demo2.hs ---------------
{-# LANGUAGE TemplateHaskell #-}
module Demo2 where
import Language.Haskell.TH
test :: Q [Dec]
test = do
let args = [] :: [String]
body = [| testFun args |]
decNm <- newName "myFunction"
(:[]) `fmap` funD decNm [clause [] (normalB body) []]
testFun :: [String] -> String
testFun _ = "hello"
Change History
Note: See
TracTickets for help on using
tickets.
