Maintainer | ongy, moepi |
---|---|
Stability | testing |
Portability | Linux |
Safe Haskell | None |
Language | Haskell2010 |
This module provides utility functions used in monky modules
- readValue :: File -> IO Int
- readValueI :: File -> IO Integer
- readValues :: File -> IO [Int]
- fopen :: String -> IO File
- fclose :: File -> IO ()
- data File
- readLine :: LineReadable a => File -> IO a
- readContent :: FileReadable a => File -> IO [a]
- findLine :: Eq a => [a] -> [[a]] -> Maybe [a]
- splitAtEvery :: String -> String -> [String]
- maybeOpenFile :: Maybe String -> IO (Maybe File)
- sdivBound :: (Integral a, Bounded a) => a -> a -> a
- sdivUBound :: Integral a => a -> a -> a -> a
- listDirectory :: FilePath -> IO [FilePath]
- data UName
- getUname :: UName
- getKernelVersion :: (Word, Word)
Documentation
readValueI :: File -> IO Integer Source #
Read the first line of the file and convert it into an Integer
readValues :: File -> IO [Int] Source #
Read the first line of the file and convert the words in it into Int
s
type alias to distinguish system functions from utility
readContent :: FileReadable a => File -> IO [a] Source #
Rewind the file descriptor and read the complete file as lines
maybeOpenFile :: Maybe String -> IO (Maybe File) Source #
fmap fopen would give Maybe (IO File), this fixes that
sdivBound :: (Integral a, Bounded a) => a -> a -> a infixl 7 Source #
0 save divide, uses maxbound for default value
sdivUBound :: Integral a => a -> a -> a -> a infixl 7 Source #
0 save divide, uses default value
listDirectory :: FilePath -> IO [FilePath] #
returns a list of all entries in dir without
the special entries (listDirectory
dir.
and ..
).
The operation may fail with:
HardwareFault
A physical I/O error has occurred.[EIO]
InvalidArgument
The operand is not a valid directory name.[ENAMETOOLONG, ELOOP]
isDoesNotExistError
/NoSuchThing
The directory does not exist.[ENOENT, ENOTDIR]
isPermissionError
/PermissionDenied
The process has insufficient privileges to perform the operation.[EACCES]
ResourceExhausted
Insufficient resources are available to perform the operation.[EMFILE, ENFILE]
InappropriateType
The path refers to an existing non-directory object.[ENOTDIR]
Since: 1.2.5.0
The haskell type for Cs utsname (man uname)
getKernelVersion :: (Word, Word) Source #
Get the kernel version as (major, minor)