diff options
| author | Tom Smeding <tom@tomsmeding.com> | 2026-05-10 22:20:13 +0200 |
|---|---|---|
| committer | Tom Smeding <tom@tomsmeding.com> | 2026-05-10 22:20:13 +0200 |
| commit | da023dfdc4884325fb62b3b101fcc8ea44772752 (patch) | |
| tree | 31c2db47b5aa07cb7302d52e8c9e9451000e2239 /server-test/Main.hs | |
| parent | e0e6b516b9dd132e067a226ff7fdf56d3e556559 (diff) | |
Clean up
Diffstat (limited to 'server-test/Main.hs')
| -rw-r--r-- | server-test/Main.hs | 4 |
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 |
