packages feed

real-dice 0.1.0.0 → 0.1.0.1

raw patch · 9 files changed

+32/−25 lines, 9 filesdep ~base

Dependency ranges changed: base

Files

CHANGELOG.md view
@@ -3,3 +3,8 @@ ## 0.1.0.0 -- 2024-05-16  * First version. Released to an eager world!+++## 0.1.0.1 -- 2024-05-17++* Fix initial bugs and mistakes in documentation
real-dice.cabal view
@@ -20,7 +20,7 @@ -- PVP summary:     +-+------- breaking API changes --                  | | +----- non-breaking API additions --                  | | | +--- code changes with no API change-version:            0.1.0.0+version:            0.1.0.1  -- A short (one-line) description of the package. synopsis:@@ -96,7 +96,7 @@     -- other-extensions:      -- Other library packages from which modules are imported.-    build-depends:    base ^>=4.18.2.0,+    build-depends:    base >=4.18.2.0 && <= 4.19.1.0,                       mtl >= 2.3.1 && < 2.4,                       primes >= 0.2.1 && < 0.3 
src/RealDice/Coin.hs view
@@ -14,8 +14,8 @@ -- | Creates a new CoinGen with the given index and the default bool table  -- | ==== __Examples__---  >>> mkCoinGen 143---  {143, rdBoolsPrime}+--   >>> mkCoinGen 143+--   {143, rdBoolsPrime} mkCoinGen :: Int -> CoinGen mkCoinGen i = mkCoinGenCustom i rdBoolsPrime 
src/RealDice/Convert/BinaryString.hs view
@@ -51,7 +51,7 @@  -- | ==== __Examples__ -- >>> binToBools "1011"--- [True, False, True, True]+-- [True,False,True,True] -- >>> binToBools "1012" -- *** Exception: Invalid binary character: '2' (valid binary characters are '0' and '1') binToBools :: String -> [Bool]@@ -62,18 +62,18 @@  -- | ==== __Examples__ -- >>> stringToBools "1011"--- [True, False, True, True]+-- [True,False,True,True] -- >>> stringToBools "1012"--- [True, False, True]+-- [True,False,True] -- >>> stringToBools "Hello, Haskell!" -- [] -- >>> stringToBools "On the 10th of March, 1901, Hacksell Kerry placed 21st\n\ \ in the 100m dash, with a time of 12.3 seconds, wearing the number 101"--- [True, False, True, False, True, True, True, False, False, True, True, False, True]+-- [True,False,True,False,True,True,True,False,False,True,True,False,True] stringToBools :: String -> [Bool] stringToBools = acc []   where     acc :: [Bool] -> String -> [Bool]     acc boolList [] = boolList-    acc boolList ('0' : xs) = acc (False : boolList) xs-    acc boolList ('1' : xs) = acc (True : boolList) xs+    acc boolList ('0' : xs) = acc (boolList ++ [False]) xs+    acc boolList ('1' : xs) = acc (boolList ++ [True]) xs     acc boolList (_ : xs) = acc boolList xs
src/RealDice/Convert/CSV.hs view
@@ -13,7 +13,7 @@ --   >>> intsToCSV [1,2,3] --   "1,2,3" intsToCSV :: [Int] -> String-intsToCSV xs = tail (take (length (show xs) - 1) (show xs))+intsToCSV xs = drop 1 (take (length (show xs) - 1) (show xs))  -- | Add square brackets `[]` to a CSV string of integers and make it into --   a list
src/RealDice/Manipulate/GetValueFromRNGTable.hs view
@@ -17,7 +17,7 @@ --   4 --   >>> getIntByIndex 5 [1, 0, 4, 3, 2] --   1---   >>> getIntByIndex -1337 [1, 0, 4,  3, 2]+--   >>> getIntByIndex (-1337) [1, 0, 4, 3, 2] --   3 getIntByIndex :: Int -> [Int] -> Int getIntByIndex index l = l !! (index `mod` length l)@@ -32,11 +32,13 @@ -- | This is used to get an element from a randomized table of booleans  -- | ==== __Examples__---   >>> getBoolByIndex 2 [True, False, True, False, True]---   True---   >>> getBoolByIndex 5 [True, False, True, False, True]+--   >>> getBoolByIndex 2 [True, False, False, True, True]+--   False+--   >>> getBoolByIndex 5 [True, False, False, True, True]+--   False+--   >>> getBoolByIndex 6 [True, False, False, True, True] --   True---   >>> getBoolByIndex -1337 [True, False, True, False, True]+--   >>> getBoolByIndex (-1337) [True, False, True, False, True] --   False getBoolByIndex :: Int -> [Bool] -> Bool getBoolByIndex index l =
src/RealDice/Manipulate/RandomizeList.hs view
@@ -19,15 +19,15 @@  -- | ==== __Examples__ --   >>> randomizeList [1, 2, 3, 4, 5]---   [2, 4, 1, 5, 3]+--   [5,3,1,2,4] randomizeList :: [Int] -> [Int] randomizeList xs = randomizeWithCustomBools xs rdBoolsPrime  -- | Randomizes the order of a list of integers using a custom list of booleans  -- | ==== __Examples__---   >>> randomizeWithCustomBools [1, 2, 3, 4, 5] [True, False, True, False, True]---   [1, 3, 5, 2, 4]+--   >>> randomizeWithCustomBools [1, 2, 3, 4, 5] [True, False, False, True, True]+--   [5,4,1,2,3] randomizeWithCustomBools :: [Int] -> [Bool] -> [Int] randomizeWithCustomBools xs boolList =   evalState@@ -43,11 +43,11 @@   if getBoolByIndex (index random) boolList     then       randomizeListWithCustomBoolListSinglePass-        (tail l)+        (drop 1 l)         (head l : l')         boolList     else       randomizeListWithCustomBoolListSinglePass-        (tail l)+        (drop 1 l)         (l' ++ [head l])         boolList
src/RealDice/RNG.hs view
@@ -22,8 +22,8 @@ -- | Creates a new RDGen with the given index and the default Int table  -- | ==== __Examples__--- >>> mkRDGen 143--- {143, rdIntsPrime}+--   >>> mkRDGen 143+--   {143, rdIntsPrime} mkRDGen :: Int -> RDGen mkRDGen i = mkRDGenCustom i rdIntsPrime 
src/RealDice/Util/Prime.hs view
@@ -16,12 +16,12 @@ --   >>> greatestPrimeNotGreaterThan 10 --   7 --   >>> greatestPrimeNotGreaterThan 1024---   1019+--   1021 --   >>> greatestPrimeNotGreaterThan 1 --   1 --   >>> greatestPrimeNotGreaterThan 0 --   0---   >>> greatestPrimeNotGreaterThan -1024+--   >>> greatestPrimeNotGreaterThan (-1024) --   0 greatestPrimeNotGreaterThan :: Int -> Int greatestPrimeNotGreaterThan n