aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/PPL/Internal.hs15
1 files changed, 9 insertions, 6 deletions
diff --git a/src/PPL/Internal.hs b/src/PPL/Internal.hs
index de48a3f..b7d49ee 100644
--- a/src/PPL/Internal.hs
+++ b/src/PPL/Internal.hs
@@ -45,12 +45,15 @@ mutateTree :: RandomGen g => Double -> Double -> g -> Tree -> Tree
mutateTree p q g (Tree a ts) =
let (r, g1) = random g
(b, g2) = random g1
- in if r >= p
- then Tree a (mutateTrees p q g1 ts)
- else
- if r < p * q
- then Tree (1 - a) (mutateTrees p q g1 ts)
- else Tree b (mutateTrees p q g2 ts)
+ in Tree
+ ( if r >= p
+ then a
+ else
+ if r < p * q
+ then 1 - a
+ else b
+ )
+ (mutateTrees p q g2 ts)
where
mutateTrees p q g (t : ts) =
let (g1, g2) = R.split g