JS
Size: a a a
JS
YS
YS
АК
YS
case f a of
?YS
к
cabal build --ghc-options "-ddump-simpl -ddump-to-file -dsuppress-all"
АК
cabal build --ghc-options "-ddump-simpl -ddump-to-file -dsuppress-all"
к
АК
JS
fallRight :: a -> e -> (a -> Maybe b) -> Either e b
fallRight a e f | Nothing <- f a = Left e
fallRight a e f | Just b <- f a = Right b
fallRight a e f = case f a of …
f a
в первом случае вычисленно единожды или по разу на каждый кейс?YS
JS
АК
YS
JS
fallRight a e f
| Nothing <- fa = Left e
| Just b <- fa = Right b
where fa = f a
JS
f a
объединит (или нет)YS
fallRight a e f
| Nothing <- fa = Left e
| Just b <- fa = Right b
where fa = f a
DG
DG