[GHC] #13773: Types are not normalized in instance declarations

GHC ghc-devs at haskell.org
Mon Jun 12 23:38:28 UTC 2017


#13773: Types are not normalized in instance declarations
-------------------------------------+-------------------------------------
        Reporter:  augustss          |                Owner:  (none)
            Type:  bug               |               Status:  new
        Priority:  normal            |            Milestone:
       Component:  Compiler          |              Version:  8.0.1
      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:                    |
-------------------------------------+-------------------------------------

Comment (by simonpj):

 It's a bit simpler than I realised.  I think you are asking

 * That in any type pattern, the compiler should fully normalise
 * And then complain if any type functions remain
 * The evidence from this normalisation can be complete discarded.  So
 {{{
 type instance F (G Int) = blah
 }}}
 would normalise `(G Int)` to (say) `Tree [Bool]`, and then behave exactly
 as if you'd written
 {{{
 type instance F (Tree [Bool]) = blah
 }}}
 If we later tried to solve a constraint involving `F (G Int)` we'd reduce
 the `G Int` to `Tree [Boo]]` and then (and only then) see the match with
 the `type instance`.

 I suppose that'd be straightforward, and clearly backward compatible.

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


More information about the ghc-tickets mailing list