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

Commits:

2 changed files:

Changes:

  • testsuite/tests/dmdanal/should_compile/T23398.hs
    ... ... @@ -6,10 +6,11 @@ type PairDict a = (Eq a, Show a)
    6 6
     foo :: PairDict a => a -> a -> String
    
    7 7
     foo x y | x==y      = show x
    
    8 8
             | otherwise = show y
    
    9
    -
    
    10
    --- In worker/wrapper we'd like to unbox the pair
    
    11
    --- but not (Eq a) and (Show a)
    
    9
    +-- In worker/wrapper we don't want to unbox PairDict
    
    10
    +-- See (DNB1) Note [Do not unbox class dictionaries] in GHC.Core.Opt.DmdAnal
    
    12 11
     
    
    13 12
     bar :: (a ~ b, Show a) => Int -> a -> (b, String)
    
    14 13
     bar 0 x = (x, show x)
    
    15 14
     bar n x = bar (n-1) x
    
    15
    +-- ...but we do want to unbox the (a~b)
    
    16
    +-- see (DNB2) in the same Note

  • testsuite/tests/dmdanal/should_compile/T23398.stderr
    1 1
     
    
    2 2
     ==================== Tidy Core ====================
    
    3 3
     Result size of Tidy Core
    
    4
    -  = {terms: 76, types: 117, coercions: 4, joins: 0/0}
    
    4
    +  = {terms: 65, types: 107, coercions: 4, joins: 0/0}
    
    5 5
     
    
    6
    --- RHS size: {terms: 18, types: 11, coercions: 0, joins: 0/0}
    
    7
    -T23398.$wfoo [InlPrag=[2]]
    
    8
    -  :: forall a. (Eq a, Show a) => a -> a -> String
    
    9
    -[GblId[StrictWorker([!, !])],
    
    10
    - Arity=4,
    
    11
    - Str=<SP(1C(1,C(1,L)),A)><SP(A,1C(1,L),A)><L><L>,
    
    12
    - Unf=Unf{Src=<vanilla>, TopLvl=True,
    
    13
    -         Value=True, ConLike=True, WorkFree=True, Expandable=True,
    
    14
    -         Guidance=IF_ARGS [30 60 0 0] 120 0}]
    
    15
    -T23398.$wfoo
    
    16
    -  = \ (@a) (ww :: Eq a) (ww1 :: Show a) (eta :: a) (eta1 :: a) ->
    
    17
    -      case == @a ww eta eta1 of {
    
    18
    -        False -> show @a ww1 eta1;
    
    19
    -        True -> show @a ww1 eta
    
    20
    -      }
    
    21
    -
    
    22
    --- RHS size: {terms: 12, types: 12, coercions: 0, joins: 0/0}
    
    23
    -foo [InlPrag=[2]] :: forall a. PairDict a => a -> a -> String
    
    6
    +-- RHS size: {terms: 20, types: 21, coercions: 0, joins: 0/0}
    
    7
    +foo :: forall a. PairDict a => a -> a -> String
    
    24 8
     [GblId,
    
    25 9
      Arity=3,
    
    26
    - Str=<S!P(SP(SC(S,C(1,L)),A),SP(A,SC(S,L),A))><L><L>,
    
    27
    - Unf=Unf{Src=StableSystem, TopLvl=True,
    
    10
    + Str=<SP(SP(1C(1,C(1,L)),A),SP(A,1C(1,L),A))><L><L>,
    
    11
    + Unf=Unf{Src=<vanilla>, TopLvl=True,
    
    28 12
              Value=True, ConLike=True, WorkFree=True, Expandable=True,
    
    29
    -         Guidance=ALWAYS_IF(arity=3,unsat_ok=True,boring_ok=False)
    
    30
    -         Tmpl= \ (@a)
    
    31
    -                 ($dCTuple2 [Occ=Once1!] :: PairDict a)
    
    32
    -                 (eta [Occ=Once1] :: a)
    
    33
    -                 (eta1 [Occ=Once1] :: a) ->
    
    34
    -                 case $dCTuple2 of { (ww [Occ=Once1], ww1 [Occ=Once1]) ->
    
    35
    -                 T23398.$wfoo @a ww ww1 eta eta1
    
    36
    -                 }}]
    
    13
    +         Guidance=IF_ARGS [90 0 0] 180 0}]
    
    37 14
     foo
    
    38 15
       = \ (@a) ($dCTuple2 :: PairDict a) (eta :: a) (eta1 :: a) ->
    
    39
    -      case $dCTuple2 of { (ww, ww1) -> T23398.$wfoo @a ww ww1 eta eta1 }
    
    16
    +      case ==
    
    17
    +             @a
    
    18
    +             (GHC.Internal.Classes.$p0CTuple2 @(Eq a) @(Show a) $dCTuple2)
    
    19
    +             eta
    
    20
    +             eta1
    
    21
    +      of {
    
    22
    +        False ->
    
    23
    +          show
    
    24
    +            @a
    
    25
    +            (GHC.Internal.Classes.$p1CTuple2 @(Eq a) @(Show a) $dCTuple2)
    
    26
    +            eta1;
    
    27
    +        True ->
    
    28
    +          show
    
    29
    +            @a
    
    30
    +            (GHC.Internal.Classes.$p1CTuple2 @(Eq a) @(Show a) $dCTuple2)
    
    31
    +            eta
    
    32
    +      }
    
    40 33
     
    
    41 34
     Rec {
    
    42 35
     -- RHS size: {terms: 21, types: 19, coercions: 3, joins: 0/0}