Skip to content

Commit 4c89f77

Browse files
slightly less dilly-dallying
1 parent 5cf6fdd commit 4c89f77

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

src/Constrained/GenT.hs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,9 @@ data GenMode
110110
-- | A `Gen` monad wrapper that allows different generation modes and different
111111
-- failure types.
112112
newtype GenT m a = GenT {runGenT :: GenMode -> [NonEmpty String] -> Gen (m a)}
113-
deriving (Functor)
113+
114+
instance Functor f => Functor (GenT f) where
115+
fmap f (GenT k) = GenT $ \ mode msgs -> fmap (fmap f) (k mode msgs)
114116

115117
instance Monad m => Applicative (GenT m) where
116118
pure a = GenT (\_ _ -> pure @Gen (pure @m a))

src/Constrained/Generation.hs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ genFromSpecT (simplifySpec -> spec) = case spec of
128128

129129
-- | A version of `genFromSpecT` that simply errors if the generator fails
130130
genFromSpec :: forall a. (HasCallStack, HasSpec a) => Specification a -> Gen a
131-
genFromSpec spec = either (error . ('\n' :) . catMessages) id <$> catchGen (genFromSpecT @a @GE spec)
131+
genFromSpec spec = genFromGenT (genFromSpecT @a @GE spec)
132132

133133
-- | A version of `genFromSpecT` that takes a seed and a size and gives you a result
134134
genFromSpecWithSeed ::

0 commit comments

Comments
 (0)