Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions constrained-generators.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ source-repository head
type: git
location: https://github.com/input-output-hk/constrained-generators

flag devel
flag dev
description: Enable development mode
default: False
manual: True
Expand Down Expand Up @@ -52,7 +52,7 @@ library

hs-source-dirs: src

if flag(devel)
if flag(dev)
exposed-modules:
Constrained.Examples
Constrained.Examples.Basic
Expand Down
15 changes: 11 additions & 4 deletions src/Constrained/Spec/SumProd.hs
Original file line number Diff line number Diff line change
Expand Up @@ -590,10 +590,17 @@ chooseSpec ::
chooseSpec (w, s) (w', s') =
constrained $ \x ->
exists (\eval -> pure $ if eval x `conformsToSpec` s then PickFirst else PickSecond) $ \p ->
caseOn
p
(branchW w' $ \_ -> (x `satisfies` s))
(branchW w $ \_ -> (x `satisfies` s'))
[ caseOn
p
(branch $ \_ -> (x `satisfies` s))
(branch $ \_ -> (x `satisfies` s'))
-- This is a bit ugly :(
, caseOn
p
(branchW w $ \_ -> True)
(branchW w' $ \_ -> True)
, x `dependsOn` p
]

data Picky = PickFirst | PickSecond deriving (Ord, Eq, Show, Generic)

Expand Down
1 change: 1 addition & 0 deletions test/Constrained/Tests.hs
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,7 @@ tests nightly =
testSpecNoShrink "threeSpecific" threeSpecific
testSpecNoShrink "threeSpecific'" threeSpecific'
testSpecNoShrink "trueSpecUniform" trueSpecUniform
testSpec "posNegDistr" posNegDistr
testSpec "ifElseMany" ifElseMany
testSpecNoShrink "propBack" propBack
testSpecNoShrink "propBack'" propBack'
Expand Down