Move module location

This commit is contained in:
Rnhmjoj 2014-10-14 18:09:58 +02:00
parent 52d4c4dbe7
commit 8a40514984
3 changed files with 9 additions and 9 deletions

View File

@ -1,7 +1,7 @@
module Diceware where module Alea.Diceware where
import qualified Data.Map as Map import qualified Data.Map as Map
import List import Alea.List
-- Diceware dictionary type -- Diceware dictionary type
type Diceware = Map.Map Int String type Diceware = Map.Map Int String

View File

@ -1,16 +1,16 @@
module List where module Alea.List where
-- Remove the nth element of a list. (0-indexed) -- Remove the nth element of a list. (0-indexed)
-- RemoveAt 2 "abc" == ('c', "ab") -- RemoveAt 2 "abc" == ('c', "ab")
removeAt :: Int -> [a] -> (a, [a]) removeAt :: Int -> [a] -> (a, [a])
removeAt n xs = (xs !! n, take n xs ++ drop (n+1) xs) removeAt n xs = (xs !! n, take n xs ++ drop (n+1) xs)
-- Split a string into a list of strings -- Split a list into a list of lists
-- ex. split "ab,cd,ef" ',' == ["ab","cd","ef"] -- ex. split "ab,cd,ef" ',' == ["ab","cd","ef"]
split :: String -> Char -> [String] split :: (Eq a) => [a] -> a -> [[a]]
split [] _ = [""] split [] _ = [[]]
split (c:cs) delim split (c:cs) delim
| c == delim = "" : rest | c == delim = [] : rest
| otherwise = (c : head rest) : tail rest | otherwise = (c : head rest) : tail rest
where where
rest = split cs delim rest = split cs delim

View File

@ -1,7 +1,7 @@
module Random where module Alea.Random where
import System.Random import System.Random
import List import Alea.List
-- Get n random numbers from the list ys -- Get n random numbers from the list ys
randPick :: (Eq a, RandomGen g) => [a] -> Int -> g -> ([a], g) randPick :: (Eq a, RandomGen g) => [a] -> Int -> g -> ([a], g)