[GHC] #9637: Type level programming needs an error function

GHC ghc-devs at haskell.org
Tue Oct 27 18:22:35 UTC 2015


#9637: Type level programming needs an error function
-------------------------------------+-------------------------------------
        Reporter:  augustss          |                Owner:
            Type:  feature request   |               Status:  new
        Priority:  normal            |            Milestone:  8.0.1
       Component:  Compiler          |              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:  #9180, #9636      |  Differential Rev(s):  Phab:D1236
       Wiki Page:                    |
-------------------------------------+-------------------------------------
Changes (by bgamari):

 * milestone:   => 8.0.1


Old description:

> When doing type level programming you often need a way to report errors.
> I suggest a closed type family called Error with special semantics.
> It is kinded like this Error :: Symbol -> k1 -> k2
>
> If this function has to be reduced during constraint solving it will
> simply generate a type error with the given string and printing the type
> as extra information (this kind can be generalized a lot if we want to).
>
> I've found that having this function gives more accurate and earlier
> error messages.
>
> Wiki design page: [wiki:CustomTypeErros]

New description:

 When doing type level programming you often need a way to report errors.
 I suggest a closed type family called Error with special semantics.
 It is kinded like this Error :: Symbol -> k1 -> k2

 If this function has to be reduced during constraint solving it will
 simply generate a type error with the given string and printing the type
 as extra information (this kind can be generalized a lot if we want to).

 I've found that having this function gives more accurate and earlier error
 messages.

 Wiki design page: [wiki:Proposal/CustomTypeErrors]

--

Comment:

 It sounds like this will make it in for 8.0.1 with an implementation by
 Iavor Diatchki. Thanks Iavor!

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


More information about the ghc-tickets mailing list