Hcy2c-0.1.1.0: Generate C code for cycle algorithms

Safe HaskellSafe
LanguageHaskell2010

Cycles.Aux

Synopsis

Documentation

goodGraphList :: Integral a => [[a]] -> Bool

This function returns True if the given graph has: a smallest vertex of index '0', sorted edges ([a,b] - a < b)

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

bool :: Integral a => Bool -> a

This function maps: True -> 1, False -> 0

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

digLen10 :: (Num a, Integral a, Eq a) => a -> a

Number of decimal digits

otherElem :: Eq a => a -> [a] -> a

Get first element of l that's not equal to a (assuming no repetitons)

unlines' :: [String] -> String

This is a custom implementation of unlines. See source for details

trim :: [a] -> [a]

This is a general typed version of trimList

hStringToCList :: String -> String

This converts a haskell type (show List) to something to be used in the C code

enum :: [a] -> [(Int, a)]

This converts a list to a [(Element Index, Element)]

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