monky-2.1.0.0: A system state collecting library and application

PortabilityLinux
Stabilitytesting
Maintainerongy, moepi
Safe HaskellSafe-Inferred

Monky.Utility

Description

This module provides utility functions used in monky modules

Synopsis

Documentation

readValue :: File -> IO IntSource

Read the first line of the file and convert it into an Int

readValues :: File -> IO [Int]Source

Read the first line of the file and convert the words in it into Ints

fopen :: String -> IO FileSource

open a file read only

fclose :: File -> IO ()Source

Close a file opened by fopen

data File Source

type alias to distinguish system functions from utility

Instances

Eq File 
Show File 

readLine :: LineReadable a => File -> IO aSource

Read the first line of the file

readContent :: FileReadable a => File -> IO [a]Source

Rewind the file descriptor and read the complete file as lines

findLine :: Eq a => [a] -> [[a]] -> Maybe [a]Source

Find a line in a list of Strings

splitAtEvery :: String -> String -> [String]Source

Split ys at every occurence of xs

maybeOpenFile :: Maybe String -> IO (Maybe File)Source

fmap fopen would give Maybe (IO File), this fixes that

sdivBound :: (Integral a, Bounded a) => a -> a -> aSource

0 save divide, uses maxbound for default value

sdivUBound :: Integral a => a -> a -> a -> aSource

0 save divide, uses default value

listDirectory :: String -> IO [String]Source