#2102: Typeclass membership doesn't bring coercion superclass requirements into
scope
----------------------------------------+-----------------------------------
    Reporter:  ryani                    |        Owner:  chak              
        Type:  bug                      |       Status:  new               
    Priority:  low                      |    Milestone:  7.0.1             
   Component:  Compiler (Type checker)  |      Version:  7.1               
    Keywords:  superclass equalities    |     Testcase:                    
   Blockedby:                           |   Difficulty:  Unknown           
          Os:  Unknown/Multiple         |     Blocking:                    
Architecture:  Unknown/Multiple         |      Failure:  Compile-time crash
----------------------------------------+-----------------------------------
Changes (by reinerp):

  * failure:  => Compile-time crash
  * version:  6.8.2 => 7.1


Comment:

 With 7.0.0-rc1 ({{{7.0.0.20100924}}}) and in HEAD, the original testcase
 reported now compiles successfully (and passes core lint as well).

 The motivating example (with coerce) in Ryan's comment also compiles, but
 fails core lint:

 {{{
 *** Core Lint errors : in result of Desugar ***
 <no location info>:
     In the coercion `co_af4'
     co_af4 is out of scope
 *** Offending Program ***
 T2102.$fValid() [InlPrag=[ALWAYS] CONLIKE] :: T2102.Valid ()
 [LclIdX[DFunId], Unf=DFun(arity=0) T2102.D:Valid []]
 T2102.$fValid() =
   T2102.D:Valid @ () @ (trans (T2102.TFCo:R:Cat()ts' ()) ())

 T2102.$fValid(,) [InlPrag=[ALWAYS] CONLIKE]
   :: forall ts_aaM s_aaN.
      T2102.Valid ts_aaM =>
      T2102.Valid (s_aaN, ts_aaM)
 [LclIdX[DFunId], Unf=DFun(arity=3) T2102.D:Valid []]
 T2102.$fValid(,) =
   \ (@ ts_aaM) (@ s_aaN) _ ->
     T2102.D:Valid @ (s_aaN, ts_aaM) @ co_af4

 T2102.coerce
   :: forall ts_aaJ (f_aaK :: * -> *).
      T2102.Valid ts_aaJ =>
      f_aaK (T2102.Cat ts_aaJ ()) -> f_aaK ts_aaJ
 [LclIdX]
 T2102.coerce =
   \ (@ ts_aeV)
     (@ f_aeW::* -> *)
     ($dValid_aeX :: T2102.Valid ts_aeV) ->
     case $dValid_aeX of _ { T2102.D:Valid @ co_afa ->
     \ (x_aaL :: f_aeW (T2102.Cat ts_aeV ())) ->
       x_aaL
       `cast` (f_aeW (trans co_afa ts_aeV)
               :: f_aeW (T2102.Cat ts_aeV ()) ~ f_aeW ts_aeV)
     }

 *** End of Offense ***
 }}}

-- 
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/2102#comment:10>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
_______________________________________________
Glasgow-haskell-bugs mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs

Reply via email to