[GHC] #10796: Illegal data constructor name: `fromList' ... When splicing a TH expression

GHC ghc-devs at haskell.org
Tue Oct 6 15:19:46 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 goldfire):

 Good point. But I'm not terribly concerned here. The current behavior of
 `dataToPatQ` in this situation (when it sees a function instead of a
 constructor) is to create some bogus Haskell. The new behavior of
 `dataToPatQ` in this situation will be to create some bogus Haskell. The
 bogus Haskell changes, but I don't think it's any worse. And, as you say,
 with this change, we could improve `dataToExpQ` to create correct Haskell.

 Perhaps better would be for calls to `dataToQa` to know when it's working
 with a pattern and fail more gracefully. That would indeed be an
 improvement.

 But I don't think that we should try too hard here. The `Data` instance
 involved is lying, calling something a constructor when it's not. If we
 can accommodate the lie easily -- as we can in `dataToExpQ` -- then great.
 Otherwise, I think it's OK to fail.

--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/10796#comment:7>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler


More information about the ghc-tickets mailing list