[GHC] #13105: Allow type families in RuntimeReps

GHC ghc-devs at haskell.org
Wed Jan 11 13:48:19 UTC 2017


#13105: Allow type families in RuntimeReps
-------------------------------------+-------------------------------------
        Reporter:  goldfire          |                Owner:
            Type:  bug               |               Status:  new
        Priority:  normal            |            Milestone:
       Component:  Compiler          |              Version:  8.0.1
      Resolution:                    |             Keywords:
                                     |  LevityPolymorphism
Operating System:  Unknown/Multiple  |         Architecture:
                                     |  Unknown/Multiple
 Type of failure:  None/Unknown      |            Test Case:
                                     |  typecheck/should_fail/T13105
      Blocked By:                    |             Blocking:
 Related Tickets:                    |  Differential Rev(s):
       Wiki Page:                    |
-------------------------------------+-------------------------------------

Comment (by goldfire):

 Yes, the levity-polymorphism check sees the problem and reports a type of
 kind `TYPE (RepRep Int)` as levity-polymorphic. I will have a note in the
 manual about this. If the type checker didn't catch it, it would be a lint
 error, yes.

 I don't think it's as simple as a normalisation step in the type checker.
 For example:

 {{{
 foo :: forall (a :: TYPE (RepRep Int)). a -> a
 foo x = x
 }}}

 In this code, `x` has type `a`. What's to normalise about that?? Now we
 could say that `x :: a |> co` where `co :: TYPE (RepRep Int) ~ TYPE
 IntRep`. But now `x`'s type has changed and that means we need to use
 casts wherever `x` has been used. And this is an easy case where the type
 checker can see the correct, normalised type from the get-go. In general,
 unification and type family reduction may be necessary before we can
 proceed.

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


More information about the ghc-tickets mailing list