[GHC] #10796: Illegal data constructor name: `fromList' ... When splicing a TH expression
GHC
ghc-devs at haskell.org
Mon Oct 5 15:54:43 UTC 2015
#10796: Illegal data constructor name: `fromList' ... When splicing a TH expression
-------------------------------------+-------------------------------------
Reporter: erisco | Owner:
Type: bug | Status: new
Priority: normal | Milestone: 8.0.1
Component: Template Haskell | Version: 7.8.3
Resolution: | Keywords: newcomer
Operating System: Unknown/Multiple | Architecture:
| Unknown/Multiple
Type of failure: None/Unknown | Test Case:
Blocked By: | Blocking:
Related Tickets: | Differential Rev(s):
-------------------------------------+-------------------------------------
Comment (by RyanGlScott):
One thing isn't clear to me about the changes proposed. We could certainly
modify `dataToQa` so that `dataToExpQ` (and thus `liftData`) works with
both function and constructor names. What about `dataToPatQ`, though?
There's no way to pattern-match on an expression directly, so what would
this translate to?
{{{#!hs
f :: Set Char -> Set Char
f s@($(dataToPatQ (const Nothing) (fromList "test"))) = s
}}}
The only way I could envision this working is if it were translated to
something like:
{{{#!hs
f :: Set Char -> Set Char
f x | x == fromList "test" = x
}}}
which is reminiscent of how pattern-matching on literals works, I suppose.
--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/10796#comment:6>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
More information about the ghc-tickets
mailing list