[GHC] #10719: Malformed data type quotation accepted

GHC ghc-devs at haskell.org
Fri Jan 8 10:29:14 UTC 2016


#10719: Malformed data type quotation accepted
-------------------------------------+-------------------------------------
        Reporter:  heisenbug         |                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):
       Wiki Page:                    |
-------------------------------------+-------------------------------------
Description changed by jstolarek:

Old description:

> This is accepted:
>
> {{{
> Prelude Language.Haskell.TH> {{{$(stringE . show =<< [d| data A where C
> :: C |])}}}
>
> "[DataD [] A_1627402878 [] [ForallC [] [] (NormalC C_1627402879 [])] []]"
> }}}
>
> In contrast this is rejected:
>
> {{{
> Prelude Language.Haskell.TH> {{{$(stringE . show =<< [d| data A p where C
> :: C |])}}}
>
> <interactive>:29:22: Malformed constructor result type: C
> }}}
>
> However it would make sense to form an equality constraint (for later
> kind/type checking) in these cases, something along the lines of:
> {{{#!hs
> data A p where
>   C :: (A p ~ C) => C
> }}}
> as there could be type synonym (or family) `C`.
>
> I have tested various versions >= 7.8.3 and all seem to behave the same.

New description:

 This is accepted:

 {{{
 Prelude Language.Haskell.TH> $(stringE . show =<< [d| data A where C :: C
 |])

 "[DataD [] A_1627402878 [] [ForallC [] [] (NormalC C_1627402879 [])] []]"
 }}}

 In contrast this is rejected:

 {{{
 Prelude Language.Haskell.TH> $(stringE . show =<< [d| data A p where C ::
 C |])

 <interactive>:29:22: Malformed constructor result type: C
 }}}

 However it would make sense to form an equality constraint (for later
 kind/type checking) in these cases, something along the lines of:
 {{{#!hs
 data A p where
   C :: (A p ~ C) => C
 }}}
 as there could be type synonym (or family) `C`.

 I have tested various versions >= 7.8.3 and all seem to behave the same.

--

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


More information about the ghc-tickets mailing list