The (->) type doesn't survive a TH quote-splice roundtrip
You can roundtrip function types like Bool -> Bool
through Template Haskell splicing:
$ /opt/ghc/8.2.2/bin/ghci -XTemplateHaskell
GHCi, version 8.2.2: http://www.haskell.org/ghc/ :? for help
Loaded GHCi configuration from /home/rgscott/.ghci
λ> :m + Language.Haskell.TH
λ> :k $([t| Bool -> Bool |])
$([t| Bool -> Bool |]) :: *
However, GHC doesn't offer the same courtesy to (->)
applied prefix, as in the following example:
λ> :k $([t| (->) Bool Bool |])
<interactive>:1:3: error:
• Illegal type constructor or class name: ‘(->)’
When splicing a TH type:
GHC.Prim.(->) GHC.Types.Bool GHC.Types.Bool
• In the untyped splice: $([t| (->) Bool Bool |])
One way to fix this would be to consistently desugar (->)
to ArrowT
in DsMeta
(instead of leaving it as GHC.Prim.(->)
).
Trac metadata
Trac field | Value |
---|---|
Version | 8.2.2 |
Type | Bug |
TypeOfFailure | OtherFailure |
Priority | normal |
Resolution | Unresolved |
Component | Template Haskell |
Test case | |
Differential revisions | |
BlockedBy | |
Related | |
Blocking | |
CC | |
Operating system | |
Architecture |