aboutsummaryrefslogtreecommitdiffstats
path: root/src/Verismith/Utils.hs
diff options
context:
space:
mode:
authorYann Herklotz <git@yannherklotz.com>2020-05-12 12:21:36 +0100
committerYann Herklotz <git@yannherklotz.com>2020-05-12 12:21:42 +0100
commit7124a4f00e536b4d5323a7488c1f65469dddb102 (patch)
tree150ccfd9bf1549c930a12ee5200826cedfa37fa3 /src/Verismith/Utils.hs
parentd1b04fc068b1484f8bd0020598d3a2f023772f46 (diff)
downloadverismith-7124a4f00e536b4d5323a7488c1f65469dddb102.tar.gz
verismith-7124a4f00e536b4d5323a7488c1f65469dddb102.zip
Format with ormolu
Diffstat (limited to 'src/Verismith/Utils.hs')
-rw-r--r--src/Verismith/Utils.hs34
1 files changed, 17 insertions, 17 deletions
diff --git a/src/Verismith/Utils.hs b/src/Verismith/Utils.hs
index 1f5dd01..0faf585 100644
--- a/src/Verismith/Utils.hs
+++ b/src/Verismith/Utils.hs
@@ -1,29 +1,29 @@
-{-|
-Module : Verismith
-Description : Verismith
-Copyright : (c) 2020, Yann Herklotz
-License : GPL-3
-Maintainer : yann [at] yannherklotz [dot] com
-Stability : experimental
-Portability : POSIX
--}
-
+-- |
+-- Module : Verismith
+-- Description : Verismith
+-- Copyright : (c) 2020, Yann Herklotz
+-- License : GPL-3
+-- Maintainer : yann [at] yannherklotz [dot] com
+-- Stability : experimental
+-- Portability : POSIX
module Verismith.Utils
- (generateByteString)
+ ( generateByteString,
+ )
where
-import System.Random (mkStdGen, newStdGen, randoms)
import Data.ByteString (ByteString, pack)
+import System.Random (mkStdGen, newStdGen, randoms)
generateByteString :: (Maybe Int) -> Int -> Int -> IO [ByteString]
generateByteString mseed size n = do
- fmap pack . chunksOf size . take (size * n) . randoms <$>
- case mseed of
- Just seed' -> return $ mkStdGen seed'
- Nothing -> newStdGen
+ fmap pack . chunksOf size . take (size * n) . randoms
+ <$> case mseed of
+ Just seed' -> return $ mkStdGen seed'
+ Nothing -> newStdGen
where
chunksOf i _ | i <= 0 = error $ "chunksOf, number must be positive, got " ++ show i
chunksOf i xs = repeatedly (splitAt i) xs
repeatedly _ [] = []
repeatedly f as = b : repeatedly f as'
- where (b, as') = f as
+ where
+ (b, as') = f as