What do two different ways of filtering a list compile to?
(Example: take a list of tuples (a,b), and return a list of a for every (a,b) where b > 1.)
| `map fst . filter ((>1) . snd)` | `[a | (a,b) <- x, b > 1]` |
|---|---|
Rec {
Main.f3 [Occ=LoopBreaker]
:: forall a_aWS. [(a_aWS, Integer)] -> [a_aWS]
Main.f3 =
\ (@ a_aWS) (ds_a16M :: [(a_aWS, Integer)]) ->
case ds_a16M of _ [Occ=Dead] {
[] -> GHC.Types.[] @ a_aWS;
: y_a16R ys_a16S ->
case y_a16R of _ [Occ=Dead] { (ds1_a17j, y1_a17k) ->
case integer-gmp-1.0.0.0:GHC.Integer.Type.gtInteger#
y1_a17k Main.f5
of wild2_a18o { __DEFAULT ->
case GHC.Prim.tagToEnum# @ Bool wild2_a18o of _ [Occ=Dead] {
False -> Main.f3 @ a_aWS ys_a16S;
True -> GHC.Types.: @ a_aWS ds1_a17j (Main.f3 @ a_aWS ys_a16S)
}
}
}
}
end Rec }
|
f2
:: forall t_aVS a_aVT.
(Num a_aVT, Ord a_aVT) =>
[(t_aVS, a_aVT)] -> [t_aVS]
f2 =
\ (@ t_aVX)
(@ a_aVY)
($dNum_aVZ :: Num a_aVY)
($dOrd_aW0 :: Ord a_aVY)
(x_aE5 :: [(t_aVX, a_aVY)]) ->
let {
lvl_s19c :: a_aVY
[LclId, Str=DmdType]
lvl_s19c = fromInteger @ a_aVY $dNum_aVZ Main.f5 } in
letrec {
go2_a16L [Occ=LoopBreaker] :: [(t_aVX, a_aVY)] -> [t_aVX]
[LclId, Arity=1, Str=DmdType ]
go2_a16L =
\ (ds_a16M :: [(t_aVX, a_aVY)]) ->
case ds_a16M of _ [Occ=Dead] {
[] -> GHC.Types.[] @ t_aVX;
: y_a16R ys_a16S ->
case y_a16R of _ [Occ=Dead] { (a1_aE6, b_aE7) ->
case > @ a_aVY $dOrd_aW0 b_aE7 lvl_s19c of _ [Occ=Dead] {
False -> go2_a16L ys_a16S;
True -> GHC.Types.: @ t_aVX a1_aE6 (go2_a16L ys_a16S)
}
}
}; } in
go2_a16L x_aE5
|