[GHC] #9813: Error when reifying type constructor

GHC ghc-devs at haskell.org
Wed Feb 10 11:26:16 UTC 2016


#9813: Error when reifying type constructor
-------------------------------------+-------------------------------------
        Reporter:  owst              |                Owner:
            Type:  bug               |               Status:  new
        Priority:  normal            |            Milestone:
       Component:  Template Haskell  |              Version:  7.8.3
      Resolution:                    |             Keywords:
Operating System:  Unknown/Multiple  |         Architecture:
                                     |  Unknown/Multiple
 Type of failure:  None/Unknown      |            Test Case:
      Blocked By:                    |             Blocking:
 Related Tickets:                    |  Differential Rev(s):  Phab:D1899
       Wiki Page:                    |
-------------------------------------+-------------------------------------

Comment (by owst):

 Apologies that it took me so long from saying I'll make the user guide
 changes to actually making them; thanks for the nudge thomie!

 Having made the doc changes, I'm still not satisfied about the {{{$(return
 [])}}} solution and I'd definitely like to try to attempt to make the
 "reasonable" use case work. To be clear, consider:

 {{{

 data A = A

 f :: Int -> Int
 f x = x + 1

 data B = B C

 g1 :: Int -> Int
 g1 x = 1 + g2 x

 exprContainingSplice1 = $(...)

 data C = C

 g2 :: Int -> Int
 g2 x = x + 2

 exprContainingSplice2 = $(...)

 }}}

 Naively, I'd expect the splice in {{{ exprContainingSplice1 }}} to be able
 to refer to {{{A}}} and {{{f}}}, but ''not'' {{{B}}} or {{{g1}}}, since
 they are in some sense "not fully defined" at the point the splice is
 encountered (assuming a top-to-bottom processing, rather than some
 topological-sorted graph-traversal). I'd also expect the splice in {{{
 exprContainingSplice2 }}} to be able to able to refer to all functions and
 and data types except probably(?) {{{exprContainingSplice1}}} and
 {{{exprContainingSplice2}}}.

 Can this be made to work, or is it nonsense?

 Simon's earlier comment
 > Moreover, types declarations are (reliably) typechecked before values
 decls. Worth looking into.
 intrigues me - I think he suggests that it might be possible for a splice
 in {{{ exprContainingSplice1 }}} to refer to {{{A}}}, but not {{{f}}}?

 If it is likely to be at all possible, does anyone have any pointers of
 likely starting points/functions I should definitely explore etc. I'd like
 to get my hands dirty!

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


More information about the ghc-tickets mailing list