Skip to content

Commit ae8ba1f

Browse files
Fix distribution control (#46)
1 parent 2b68967 commit ae8ba1f

File tree

3 files changed

+14
-6
lines changed

3 files changed

+14
-6
lines changed

constrained-generators.cabal

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ source-repository head
1515
type: git
1616
location: https://github.com/input-output-hk/constrained-generators
1717

18-
flag devel
18+
flag dev
1919
description: Enable development mode
2020
default: False
2121
manual: True
@@ -52,7 +52,7 @@ library
5252

5353
hs-source-dirs: src
5454

55-
if flag(devel)
55+
if flag(dev)
5656
exposed-modules:
5757
Constrained.Examples
5858
Constrained.Examples.Basic

src/Constrained/Spec/SumProd.hs

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -590,10 +590,17 @@ chooseSpec ::
590590
chooseSpec (w, s) (w', s') =
591591
constrained $ \x ->
592592
exists (\eval -> pure $ if eval x `conformsToSpec` s then PickFirst else PickSecond) $ \p ->
593-
caseOn
594-
p
595-
(branchW w' $ \_ -> (x `satisfies` s))
596-
(branchW w $ \_ -> (x `satisfies` s'))
593+
[ caseOn
594+
p
595+
(branch $ \_ -> (x `satisfies` s))
596+
(branch $ \_ -> (x `satisfies` s'))
597+
-- This is a bit ugly :(
598+
, caseOn
599+
p
600+
(branchW w $ \_ -> True)
601+
(branchW w' $ \_ -> True)
602+
, x `dependsOn` p
603+
]
597604

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

test/Constrained/Tests.hs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,7 @@ tests nightly =
154154
testSpecNoShrink "threeSpecific" threeSpecific
155155
testSpecNoShrink "threeSpecific'" threeSpecific'
156156
testSpecNoShrink "trueSpecUniform" trueSpecUniform
157+
testSpec "posNegDistr" posNegDistr
157158
testSpec "ifElseMany" ifElseMany
158159
testSpecNoShrink "propBack" propBack
159160
testSpecNoShrink "propBack'" propBack'

0 commit comments

Comments
 (0)