JS
genMaybeIfFoo :: Gen f => Param -> f a -> f (Maybe a)
genMaybeIfFoo p gen
| isFoo p = Gen.maybe gen
| otherwise = pure Nothing
и чувствую, что single responsibility principle нарушается. как бы отсюда Gen.maybe вынести?
Size: a a a
JS
genMaybeIfFoo :: Gen f => Param -> f a -> f (Maybe a)
genMaybeIfFoo p gen
| isFoo p = Gen.maybe gen
| otherwise = pure Nothing
AR
x = [ one
, two
, three
]
JS
x = [
, one
, two
, three
]
JS
JS
ЗП
bool def gen . condition
?AR
genMaybeFromBool :: Gen f => (p -> Bool) -> p -> f a -> f (Maybe a)
genMaybeFromBool f a g =
| f a -> Gen.maybe g
| otherwise -> pure Nothing
JS
JS
JS
NA