summaryrefslogtreecommitdiff
path: root/server-test/Main.hs
diff options
context:
space:
mode:
Diffstat (limited to 'server-test/Main.hs')
-rw-r--r--server-test/Main.hs4
1 files changed, 3 insertions, 1 deletions
diff --git a/server-test/Main.hs b/server-test/Main.hs
index d15ad70..43cba76 100644
--- a/server-test/Main.hs
+++ b/server-test/Main.hs
@@ -1,6 +1,7 @@
{-# LANGUAGE OverloadedStrings #-}
module Main where
+import Control.Monad (when)
import Control.Monad.Trans.State.Strict
import Data.ByteString (ByteString)
import Data.ByteString qualified as BS
@@ -19,7 +20,8 @@ randomSlicing 1 target = return [target]
randomSlicing numslice target = do
n1 <- Gen.integral (Range.constant 1 (target - numslice))
ns <- (n1:) <$> go (numslice - 1) (target - n1)
- if sum ns /= target || any (== 0) ns then error (show (ns, target)) else return ()
+ when (sum ns /= target || any (== 0) ns) $
+ error (show (ns, target))
Gen.shuffle ns
where
go 1 tg