Safe Haskell | Safe |
---|---|
Language | Haskell2010 |
Cycles.Aux
- goodGraphList :: Integral a => [[a]] -> Bool
- trimList :: Integral a => [a] -> [a]
- wrapAround :: [a] -> [a]
- elemIndex' :: (Eq a, Integral b) => a -> [a] -> b -> b
- bool :: Integral a => Bool -> a
- replicate' :: Integral b => a -> b -> [a]
- padMod :: [Int] -> Int -> Int -> [Int]
- elemIndex'' :: (Eq a, Integral b) => a -> [a] -> b -> Maybe b
- getElem :: Integral b => [a] -> b -> a
- formatByDict :: String -> [(String, String)] -> String
- padStrLeft0s :: String -> Int -> String
- digLen10 :: (Num a, Integral a, Eq a) => a -> a
- otherElem :: Eq a => a -> [a] -> a
- unlines' :: [String] -> String
- trim :: [a] -> [a]
- hStringToCList :: String -> String
- enum :: [a] -> [(Int, a)]
- orientGraph :: (Ord a1, Num a1, Num a, Eq a) => [a] -> [[a1]] -> [[a1]]
Documentation
goodGraphList :: Integral a => [[a]] -> Bool
trimList :: Integral a => [a] -> [a]
Given a list of the form [a,b..c,d] this function will return [b..c], trimming off the first and last elements
wrapAround :: [a] -> [a]
wrapAround
appends the first element to the list
elemIndex' :: (Eq a, Integral b) => a -> [a] -> b -> b
elemIndex'
is the same as elemIndex
, except it allows for any Integral type as the index and has no Maybe
replicate' :: Integral b => a -> b -> [a]
length'
outputs a general Integral type
length' :: [a] -> Int
length' = length
length' :: (Eq a, Integral b) => [a] -> b
length' l = if null l then 0 else 1 + length' (tail l)
This is an integral type allowing version of replicate
padMod :: [Int] -> Int -> Int -> [Int]
padMod
pads the end of the list with the given padding so that the final length is 0 modulo the given modulus
padMod :: Integral a => [a] -> a -> a -> [a]
padMod list padding modulus = list ++ replicate' padding extra
where
extra = mod ((-1) * length' list) modulus
elemIndex'' :: (Eq a, Integral b) => a -> [a] -> b -> Maybe b
elemIndex''
is the same as elemIndex'
, except it allows Maybe
getElem :: Integral b => [a] -> b -> a
This function takes a list and position and gets the element in the list at that position (without using a Maybe t0)
formatByDict :: String -> [(String, String)] -> String
formatByDict
takes a string and a dictionary composed of [(key_string, result_string)] and returns the string with the appropriate key replaced (if any) ((only replaces one key))
padStrLeft0s :: String -> Int -> String
For padStrLeft0s
s t, s
is the string, l
is how long to make the final one
padStrLeft0s :: (Integral a) => String -> a -> String
padStrLeft0s s t = if length' s >= t then s else padStrLeft0s ('0':s) t
otherElem :: Eq a => a -> [a] -> a
Get first element of l that's not equal to a
(assuming no repetitons)
hStringToCList :: String -> String
This converts a haskell type (show List) to something to be used in the C code
orientGraph :: (Ord a1, Num a1, Num a, Eq a) => [a] -> [[a1]] -> [[a1]]
This function takes a list of directions encoded as '1's and '0's ('0' is forward, i.e. [a,b] -> a<b) and a graph and returns a digraph