monky-2.2.0.0: A system state collecting library and application

Maintainerongy, moepi
Stabilitytesting
PortabilityLinux
Safe HaskellNone
LanguageHaskell2010

Monky.Utility

Description

This module provides utility functions used in monky modules

Synopsis

Documentation

readValue :: File -> IO Int Source #

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 File Source #

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 Source # 

Methods

(==) :: File -> File -> Bool #

(/=) :: File -> File -> Bool #

Show File Source # 

Methods

showsPrec :: Int -> File -> ShowS #

show :: File -> String #

showList :: [File] -> ShowS #

readLine :: LineReadable a => File -> IO a Source #

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 -> 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] #

listDirectory dir returns a list of all entries in dir without the special entries (. 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

data UName Source #

The haskell type for Cs utsname (man uname)

Instances

getUname :: UName Source #

Get the kernel nameversionrelease and so forth

getKernelVersion :: (Word, Word) Source #

Get the kernel version as (major, minor)