Simon Peyton Jones pushed to branch wip/T27828 at Glasgow Haskell Compiler / GHC

Commits:

2 changed files:

Changes:

  • compiler/GHC/Core/FamInstEnv.hs
    ... ... @@ -604,8 +604,8 @@ data BranchCompatibility
    604 604
       | BC_Incompat  -- LHSs unify with S, and S(rhs1)/=S(rhs2)
    
    605 605
     
    
    606 606
     compareBranches :: CoAxBranch -> CoAxBranch -> BranchCompatibility
    
    607
    -compareBranches b1@(CoAxBranch { cab_lhs = lhs1, cab_rhs = rhs1 })
    
    608
    -                b2@(CoAxBranch { cab_lhs = lhs2, cab_rhs = rhs2 })
    
    607
    +compareBranches (CoAxBranch { cab_lhs = lhs1, cab_rhs = rhs1 })
    
    608
    +                (CoAxBranch { cab_lhs = lhs2, cab_rhs = rhs2 })
    
    609 609
       = case tcUnifyTysFG alwaysBindFam alwaysBindTv commonlhs1 commonlhs2 of
    
    610 610
           -- Here we need the cab_tvs of the two branches to be disinct.
    
    611 611
           -- See Note [CoAxBranch type variables] in GHC.Core.Coercion.Axiom.
    

  • testsuite/tests/indexed-types/should_compile/T27828a.hs
    1
    +{-# LANGUAGE TypeFamilies #-}
    
    2
    +
    
    3
    +module T27828a where
    
    4
    +
    
    5
    +import Data.Proxy
    
    6
    +
    
    7
    +type family F a where
    
    8
    +  F Int = Int   -- B1
    
    9
    +  F Char = Bool -- B2
    
    10
    +  F a   = a     -- B3
    
    11
    +
    
    12
    +h :: (F a ~ Int) => Proxy a -> ()
    
    13
    +h = error "urk"
    
    14
    +
    
    15
    +k :: ()
    
    16
    +k = h Proxy      -- [W] F alpha ~ Int