@@ -30,7 +30,7 @@ import Data.Unfoldable
30
30
)
31
31
import Data.Tuple (uncurry , fst , snd )
32
32
import Data.Tuple.Nested ((/\), type (/\))
33
- import Data.Maybe (Maybe (..), maybe' , fromMaybe )
33
+ import Data.Maybe (Maybe (..), maybe' )
34
34
import Data.Exists (Exists , mkExists , runExists )
35
35
import Data.Bifunctor (lmap )
36
36
import Data.Functor.Invariant (class Invariant , imapF )
@@ -42,7 +42,7 @@ import Data.Filterable
42
42
, filterMapDefault
43
43
)
44
44
import Data.Either (Either (..), either )
45
- import Control.Alternative (class Alt , class Plus , class Alternative )
45
+ import Control.Alternative (class Alt , class Plus , class Alternative , (<|>) )
46
46
import Control.Lazy (class Lazy )
47
47
import Test.QuickCheck.Arbitrary (class Arbitrary , class Coarbitrary , arbitrary )
48
48
import Test.QuickCheck.Gen (sized )
@@ -211,13 +211,12 @@ instance trivialAlt :: Alt Trivial where
211
211
alt :: forall a . Trivial a -> Trivial a -> Trivial a
212
212
alt t = untrivial (untrivial eAlt t)
213
213
where eAlt :: forall b b' . Generator a b -> b -> Generator a b' -> b' -> Trivial a
214
- eAlt f seed f' seed' = unfoldr smooshed $ Just seed /\ seed'
215
- where smooshed :: Maybe b /\ b' -> Maybe (a /\ Maybe b /\ b' )
216
- smooshed (Just b /\ b') = do
217
- let dom = f b
218
- a' /\ nb' <- f' b'
219
- Just $ fromMaybe a' (fst <$> dom) /\ map snd dom /\ nb'
220
- smooshed (Nothing /\ b') = map (Nothing /\ _) <$> f' b'
214
+ eAlt f seed f' seed' = unfoldr smooshed $ Just seed /\ Just seed'
215
+ where smooshed :: Maybe b /\ Maybe b' -> Maybe (a /\ Maybe b /\ Maybe b' )
216
+ smooshed (b /\ b') = (map fst top <|> map fst me) <#> (_ /\ map snd top /\ map snd me)
217
+ where top = f =<< b
218
+ me = f' =<< b'
219
+
221
220
222
221
223
222
instance trivialMonoid :: Monoid (Trivial a ) where
0 commit comments