keter-0.3.5.4: Web application deployment manager, focusing on Haskell web frameworks

Safe HaskellNone

Keter.Prelude

Contents

Synopsis

Documentation

class Monad m where

The Monad class defines the basic operations over a monad, a concept from a branch of mathematics known as category theory. From the perspective of a Haskell programmer, however, it is best to think of a monad as an abstract datatype of actions. Haskell's do expressions provide a convenient syntax for writing monadic expressions.

Minimal complete definition: >>= and return.

Instances of Monad should satisfy the following laws:

 return a >>= k  ==  k a
 m >>= return  ==  m
 m >>= (\x -> k x >>= h)  ==  (m >>= k) >>= h

Instances of both Monad and Functor should additionally satisfy the law:

 fmap f xs  ==  xs >>= return . f

The instances of Monad for lists, Maybe and IO defined in the Prelude satisfy these laws.

Methods

(>>=) :: m a -> (a -> m b) -> m b

Sequentially compose two actions, passing any value produced by the first as an argument to the second.

(>>) :: m a -> m b -> m b

Sequentially compose two actions, discarding any value produced by the first, like sequencing operators (such as the semicolon) in imperative languages.

return :: a -> m a

Inject a value into the monadic type.

fail :: String -> m a

Fail with a message. This operation is not part of the mathematical definition of a monad, but is invoked on pattern-match failure in a do expression.

Instances

Monad [] 
Monad IO 
Monad Q 
Monad Maybe 
Monad Result 
Monad Parser 
Monad STM 
Monad Vector 
Monad Put 
Monad Identity 
Monad Parser 
Monad Id 
Monad Box 
Monad Stream 
Monad KIO 
Monad ((->) r) 
Monad (Either e) 
Monad (ST s) 
Monad (Parser t) 
Monad (ST s) 
ArrowApply a => Monad (ArrowMonad a) 
Monad m => Monad (ExceptionT m) 
Monad m => Monad (ResourceT m) 
Monad m => Monad (ListT m) 
Monad (Partial e) 
Monad m => Monad (MaybeT m) 
Monad m => Monad (IdentityT m) 
Monad m => Monad (PErrorT m) 
(Monad m, Error e) => Monad (ErrorT e m) 
Monad m => Monad (ReaderT r m) 
Monad m => Monad (StateT s m) 
Monad m => Monad (StateT s m) 
(Monoid w, Monad m) => Monad (WriterT w m) 
(Monoid w, Monad m) => Monad (WriterT w m) 
Monad m => Monad (ConduitM i o m) 
(Monoid w, Monad m) => Monad (RWST r w s m) 
(Monoid w, Monad m) => Monad (RWST r w s m) 
Monad m => Monad (Pipe l i o u m) 

data Maybe a

The Maybe type encapsulates an optional value. A value of type Maybe a either contains a value of type a (represented as Just a), or it is empty (represented as Nothing). Using Maybe is a good way to deal with errors or exceptional cases without resorting to drastic measures such as error.

The Maybe type is also a monad. It is a simple kind of error monad, where all errors are represented by Nothing. A richer error monad can be built using the Either type.

Constructors

Nothing 
Just a 

Instances

Monad Maybe 
Functor Maybe 
Typeable1 Maybe 
MonadPlus Maybe 
Applicative Maybe 
Alternative Maybe 
MonadThrow Maybe 
MonadBaseControl Maybe Maybe 
MonadBase Maybe Maybe 
Eq a => Eq (Maybe a) 
Ord a => Ord (Maybe a) 
Show a => Show (Maybe a) 
ToJSON a => ToJSON (Maybe a) 
FromJSON a => FromJSON (Maybe a) 
Monoid a => Monoid (Maybe a)

Lift a semigroup into Maybe forming a Monoid according to http://en.wikipedia.org/wiki/Monoid: "Any semigroup S may be turned into a monoid simply by adjoining an element e not in S and defining e*e = e and e*s = s = s*e for all s ∈ S." Since there is no "Semigroup" typeclass providing just mappend, we use Monoid instead.

Hashable a => Hashable (Maybe a) 
CanNull (Maybe a) 
Eq a => CanIsInfixOf (Maybe a) 
CanReverse (Maybe a) 
Default (Maybe a) 
Lift a => Lift (Maybe a) 
CanFilter (Maybe a) a 
CanLength (Maybe a) Int 
CanSingleton (Maybe a) a 
CanPack (Maybe a) a 
CanMapM_ (Maybe a) a 
Eq x => CanMember (Maybe x) x 
CanAny (Maybe a) a 
CanFind (Maybe a) a 
CanFold (Maybe a) a accum 
CanMap (Maybe a) (Maybe b) a b 
Monad m => CanMapM (Maybe i) (m (Maybe o)) m i o 
CanConcatMap (Maybe a) (Maybe b) a (Maybe b) 

($) :: (a -> b) -> a -> b

Application operator. This operator is redundant, since ordinary application (f x) means the same as (f $ x). However, $ has low, right-associative binding precedence, so it sometimes allows parentheses to be omitted; for example:

     f $ g $ h x  =  f (g (h x))

It is also useful in higher-order situations, such as map ($ 0) xs, or zipWith ($) fs xs.

(.) :: (b -> c) -> (a -> b) -> a -> c

Function composition.

toString :: ToString a => a -> StringSource

map :: (a -> b) -> [a] -> [b]

map f xs is the list obtained by applying f to each element of xs, i.e.,

 map f [x1, x2, ..., xn] == [f x1, f x2, ..., f xn]
 map f [x1, x2, ...] == [f x1, f x2, ...]

(***) :: Arrow a => forall b c b' c'. a b c -> a b' c' -> a (b, b') (c, c')

Split the input between the two argument arrows and combine their output. Note that this is in general not a functor.

The default definition may be overridden with a more efficient version if desired.

data Either a b

The Either type represents values with two possibilities: a value of type Either a b is either Left a or Right b.

The Either type is sometimes used to represent a value which is either correct or an error; by convention, the Left constructor is used to hold an error value and the Right constructor is used to hold a correct value (mnemonic: "right" also means "correct").

Constructors

Left a 
Right b 

Instances

Typeable2 Either 
Monad (Either e) 
Functor (Either a) 
Error e => MonadPlus (Either e) 
Applicative (Either e) 
Error e => Alternative (Either e) 
MonadThrow (Either SomeException) 
MonadBaseControl (Either e) (Either e) 
MonadBase (Either e) (Either e) 
(Eq a, Eq b) => Eq (Either a b) 
(Ord a, Ord b) => Ord (Either a b) 
(Read a, Read b) => Read (Either a b) 
(Show a, Show b) => Show (Either a b) 
(ToJSON a, ToJSON b) => ToJSON (Either a b) 
(FromJSON a, FromJSON b) => FromJSON (Either a b) 
(Hashable a, Hashable b) => Hashable (Either a b) 
(Lift a, Lift b) => Lift (Either a b) 

either :: (a -> c) -> (b -> c) -> Either a b -> c

Case analysis for the Either type. If the value is Left a, apply the first function to a; if it is Right b, apply the second function to b.

data SomeException

The SomeException type is the root of the exception type hierarchy. When an exception of type e is thrown, behind the scenes it is encapsulated in a SomeException.

runKIO :: (LogMessage -> IO ()) -> KIO a -> IO aSource

void :: Monad m => m a -> m ()Source

forkKIO :: KIO () -> KIO ()Source

(++) :: Monoid m => m -> m -> mSource

minBound :: Bounded a => a

succ :: Enum a => a -> a

the successor of a value. For numeric types, succ adds 1.

show :: Show a => a -> TextSource

when :: Monad m => Bool -> m () -> m ()

Conditional execution of monadic expressions. For example,

       when debug (putStr "Debugging\n")

will output the string Debugging\n if the Boolean value debug is True, and otherwise do nothing.

fromText :: FromText a => Text -> aSource

flip :: (a -> b -> c) -> b -> a -> c

flip f takes its (first) two arguments in the reverse order of f.

class Show a

Conversion of values to readable Strings.

Minimal complete definition: showsPrec or show.

Derived instances of Show have the following properties, which are compatible with derived instances of Read:

  • The result of show is a syntactically correct Haskell expression containing only constants, given the fixity declarations in force at the point where the type is declared. It contains only the constructor names defined in the data type, parentheses, and spaces. When labelled constructor fields are used, braces, commas, field names, and equal signs are also used.
  • If the constructor is defined to be an infix operator, then showsPrec will produce infix applications of the constructor.
  • the representation will be enclosed in parentheses if the precedence of the top-level constructor in x is less than d (associativity is ignored). Thus, if d is 0 then the result is never surrounded in parentheses; if d is 11 it is always surrounded in parentheses, unless it is an atomic expression.
  • If the constructor is defined using record syntax, then show will produce the record-syntax form, with the fields given in the same order as the original declaration.

For example, given the declarations

 infixr 5 :^:
 data Tree a =  Leaf a  |  Tree a :^: Tree a

the derived instance of Show is equivalent to

 instance (Show a) => Show (Tree a) where

        showsPrec d (Leaf m) = showParen (d > app_prec) $
             showString "Leaf " . showsPrec (app_prec+1) m
          where app_prec = 10

        showsPrec d (u :^: v) = showParen (d > up_prec) $
             showsPrec (up_prec+1) u .
             showString " :^: "      .
             showsPrec (up_prec+1) v
          where up_prec = 5

Note that right-associativity of :^: is ignored. For example,

  • show (Leaf 1 :^: Leaf 2 :^: Leaf 3) produces the string "Leaf 1 :^: (Leaf 2 :^: Leaf 3)".

Instances

Show Bool 
Show Char 
Show Double 
Show Float 
Show Int 
Show Int8 
Show Int16 
Show Int32 
Show Int64 
Show Integer 
Show Ordering 
Show Word 
Show Word8 
Show Word16 
Show Word32 
Show Word64 
Show Exp 
Show Match 
Show Clause 
Show Pat 
Show Type 
Show Dec 
Show Name 
Show FunDep 
Show Pred 
Show TyVarBndr 
Show () 
Show Con 
Show ByteString 
Show Builder 
Show Number 
Show Text 
Show UTCTime 
Show DotNetTime 
Show Value 
Show Handle 
Show ByteString 
Show More 
Show Timeout 
Show State 
Show HandleType 
Show HandlePosn 
Show FdKey 
Show CDev 
Show CIno 
Show CMode 
Show COff 
Show CPid 
Show CSsize 
Show CGid 
Show CNlink 
Show CUid 
Show CCc 
Show CSpeed 
Show CTcflag 
Show CRLim 
Show Fd 
Show PatternMatchFail 
Show RecSelError 
Show RecConError 
Show RecUpdError 
Show NoMethodError 
Show NonTermination 
Show NestedAtomically 
Show ThreadId 
Show BlockReason 
Show ThreadStatus 
Show BlockedIndefinitelyOnMVar 
Show BlockedIndefinitelyOnSTM 
Show Deadlock 
Show AssertionFailed 
Show AsyncException 
Show ArrayException 
Show ExitCode 
Show IOErrorType 
Show BufferMode 
Show Newline 
Show NewlineMode 
Show TextEncoding 
Show CodingProgress 
Show All 
Show Any 
Show WordPtr 
Show IntPtr 
Show CChar 
Show CSChar 
Show CUChar 
Show CShort 
Show CUShort 
Show CInt 
Show CUInt 
Show CLong 
Show CULong 
Show CLLong 
Show CULLong 
Show CFloat 
Show CDouble 
Show CPtrdiff 
Show CSize 
Show CWchar 
Show CSigAtomic 
Show CClock 
Show CTime 
Show CUSeconds 
Show CSUSeconds 
Show CIntPtr 
Show CUIntPtr 
Show CIntMax 
Show CUIntMax 
Show SeekMode 
Show IOMode 
Show MaskingState 
Show IOException 
Show SomeException 
Show ErrorCall 
Show ArithException 
Show TypeRep 
Show TyCon 
Show FilePath 
Show Text 
Show DiffTime 
Show AESRNG 
Show GenError 
Show ReseedPolicy 
Show FDEvent 
Show INotify 
Show WatchDescriptor 
Show Cookie 
Show Event 
Show ConnHost 
Show ConnKey 
Show Proxy 
Show HttpException 
Show Cookie 
Show CookieJar 
Show StdMethod 
Show Status 
Show HttpVersion 
Show PortID 
Show SocketOption 
Show AddrInfoFlag 
Show AddrInfo 
Show NameInfoFlag 
Show Socket 
Show SocketStatus 
Show SocketType 
Show Family 
Show PortNumber 
Show SockAddr 
Show HostPreference 
Show StdGen 
Show InvalidAccess 
Show FileNameError 
Show TarBombError 
Show PortabilityError 
Show FormatError 
Show Info 
Show Fixity 
Show FixityDirection 
Show Lit 
Show Body 
Show Guard 
Show Stmt 
Show Range 
Show FamFlavour 
Show Foreign 
Show Callconv 
Show Safety 
Show Pragma 
Show Inline 
Show RuleMatch 
Show Phases 
Show RuleBndr 
Show Strict 
Show TyLit 
Show Size 
Show UnicodeException 
Show Padding 
Show DateFormatSpec 
Show LocalTime 
Show ZonedTime 
Show TimeOfDay 
Show TimeZone 
Show NominalDiffTime 
Show Day 
Show GroupEntry 
Show UserEntry 
Show Size 
Show Void 
Show FilePart 
Show Piece 
Show EventType 
Show ToEventRawException 
Show ParseException 
Show Event 
Show Style 
Show Tag 
Show YamlMark 
Show YamlException 
Show DictionaryHash 
Show KeterException 
Show LogMessage 
Show DBInfo 
Show a => Show [a] 
(Integral a, Show a) => Show (Ratio a) 
Show (Ptr a) 
Show (FunPtr a) 
Show a => Show (Maybe a) 
Show a => Show (Result a) 
Show (ForeignPtr a) 
HasResolution a => Show (Fixed a) 
Show a => Show (Dual a) 
Show a => Show (Sum a) 
Show a => Show (Product a) 
Show a => Show (First a) 
Show a => Show (Last a) 
Show a => Show (Vector a) 
Show a => Show (Set a) 
Show s => Show (CI s) 
Show a => Show (Flush a) 
Show (Request m) 
Show (RequestBody m)

Since 1.8.7

Show body => Show (Response body) 
Show (Rules a) 
Show a => Show (Array a) 
(Show a, Unbox a) => Show (Vector a) 
(Show a, Show b) => Show (Either a b) 
(Show a, Show b) => Show (a, b) 
(Show k, Show v) => Show (HashMap k v) 
(Show k, Show a) => Show (Map k a) 
Show (ST s a) 
(Show t, Show r) => Show (IResult t r) 
(Show a, Show b, Show c) => Show (a, b, c) 
(Show a, Show b, Show c, Show d) => Show (a, b, c, d) 
(Show a, Show b, Show c, Show d, Show e) => Show (a, b, c, d, e) 
(Show a, Show b, Show c, Show d, Show e, Show f) => Show (a, b, c, d, e, f) 
(Show a, Show b, Show c, Show d, Show e, Show f, Show g) => Show (a, b, c, d, e, f, g) 
(Show a, Show b, Show c, Show d, Show e, Show f, Show g, Show h) => Show (a, b, c, d, e, f, g, h) 
(Show a, Show b, Show c, Show d, Show e, Show f, Show g, Show h, Show i) => Show (a, b, c, d, e, f, g, h, i) 
(Show a, Show b, Show c, Show d, Show e, Show f, Show g, Show h, Show i, Show j) => Show (a, b, c, d, e, f, g, h, i, j) 
(Show a, Show b, Show c, Show d, Show e, Show f, Show g, Show h, Show i, Show j, Show k) => Show (a, b, c, d, e, f, g, h, i, j, k) 
(Show a, Show b, Show c, Show d, Show e, Show f, Show g, Show h, Show i, Show j, Show k, Show l) => Show (a, b, c, d, e, f, g, h, i, j, k, l) 
(Show a, Show b, Show c, Show d, Show e, Show f, Show g, Show h, Show i, Show j, Show k, Show l, Show m) => Show (a, b, c, d, e, f, g, h, i, j, k, l, m) 
(Show a, Show b, Show c, Show d, Show e, Show f, Show g, Show h, Show i, Show j, Show k, Show l, Show m, Show n) => Show (a, b, c, d, e, f, g, h, i, j, k, l, m, n) 
(Show a, Show b, Show c, Show d, Show e, Show f, Show g, Show h, Show i, Show j, Show k, Show l, Show m, Show n, Show o) => Show (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o) 

class Default a where

A class for types with a default value.

Methods

def :: a

The default value for this type.

data Int

A fixed-precision integer type with at least the range [-2^29 .. 2^29-1]. The exact range for a given implementation can be determined by using minBound and maxBound from the Bounded class.

Instances

Bounded Int 
Enum Int 
Eq Int 
Integral Int 
Num Int 
Ord Int 
Real Int 
Show Int 
Typeable Int 
ToJSON Int 
FromJSON Int 
Storable Int 
Bits Int 
Unbox Int 
Hashable Int 
Default Int 
Random Int 
Lift Int 
CanLength Text Int 
CanLength ByteString Int 
CanSplitAt Text Int 
CanSplitAt ByteString Int 
Vector Vector Int 
MVector MVector Int 
CanReplicate Text Text Int 
CanReplicate ByteString Word8 Int 
RegexLike a b => RegexContext a b Int 
RegexLike a b => RegexContext a b MatchArray 
RegexLike a b => RegexContext a b [MatchArray] 
RegexLike a b => RegexContext a b [MatchText b] 
RegexLike a b => RegexContext a b (AllTextSubmatches (Array Int) (b, (MatchOffset, MatchLength))) 
RegexLike a b => RegexContext a b (AllTextSubmatches [] (b, (MatchOffset, MatchLength))) 
RegexLike a b => RegexContext a b (AllTextSubmatches (Array Int) b) 
RegexLike a b => RegexContext a b (AllTextMatches (Array Int) (MatchText b)) 
RegexLike a b => RegexContext a b (AllTextMatches (Array Int) b) 
RegexLike a b => RegexContext a b (AllTextMatches (Array Int) [b]) 
RegexLike a b => RegexContext a b (AllTextMatches [] (Array Int b)) 
RegexLike a b => RegexContext a b (AllTextMatches (Array Int) (Array Int b)) 
RegexLike a b => RegexContext a b (AllSubmatches [] (MatchOffset, MatchLength)) 
RegexLike a b => RegexContext a b (AllMatches [] (MatchOffset, MatchLength)) 
RegexLike a b => RegexContext a b (AllMatches (Array Int) (MatchOffset, MatchLength)) 
RegexLike a b => RegexContext a b (AllMatches (Array Int) MatchArray) 
RegexLike a b => RegexContext a b (MatchOffset, MatchLength) 
RegexLike a b => RegexContext a b (b, MatchText b, b) 
CanLength [a] Int 
CanLength (Maybe a) Int 
CanLength (Vector a) Int 
CanLength (HashSet x) Int 
CanLength (Set x) Int 
CanLength (Seq a) Int 
CanSplitAt [c] Int 
CanSplitAt (Vector a) Int 
CanSplitAt (Seq a) Int 
CanReplicateM [a] a Int 
CanReplicateM (Vector a) a Int 
CanReplicateM (Seq a) a Int 
CanReplicate [i] i Int 
CanReplicate (Vector a) a Int 
CanReplicate (Seq a) a Int 
CanLength (HashMap k v) Int 
CanLength (Map k v) Int 

(&&) :: Bool -> Bool -> Bool

Boolean "and"

(==) :: Eq a => a -> a -> Bool

(/=) :: Eq a => a -> a -> Bool

(*) :: Num a => a -> a -> a

fromIntegral :: (Integral a, Num b) => a -> b

general coercion from integral types

reverse :: [a] -> [a]

reverse xs returns the elements of xs in reverse order. xs must be finite.

otherwise :: Bool

otherwise is defined as the value True. It helps to make guards more readable. eg.

  f x | x < 0     = ...
      | otherwise = ...

timeout :: Int -> KIO a -> KIO (Maybe a)Source

id :: a -> a

Identity function.

filter :: (a -> Bool) -> [a] -> [a]

filter, applied to a predicate and a list, returns the list of those elements that satisfy the predicate; i.e.,

 filter p xs = [ x | x <- xs, p x]

mapM_ :: Monad m => (a -> m b) -> [a] -> m ()

mapM_ f is equivalent to sequence_ . map f.

fmap :: Functor f => forall a b. (a -> b) -> f a -> f b

not :: Bool -> Bool

Boolean "not"

maybe :: b -> (a -> b) -> Maybe a -> b

The maybe function takes a default value, a function, and a Maybe value. If the Maybe value is Nothing, the function returns the default value. Otherwise, it applies the function to the value inside the Just and returns the result.

(>) :: Ord a => a -> a -> Bool

(<) :: Ord a => a -> a -> Bool

(<=) :: Ord a => a -> a -> Bool

(+) :: Num a => a -> a -> a

(-) :: Num a => a -> a -> a

Filepath

(</>) :: FilePath -> FilePath -> FilePath

An alias for append.

(<.>) :: FilePath -> Text -> FilePath

An alias for addExtension.

isDirectory :: FilePath -> IO Bool

Check if a directory exists at the given path.

Symbolic links are resolved to their targets before checking their type.

This computation does not throw exceptions.

isFile :: FilePath -> IO Bool

Check if a file exists at the given path.

Any non‐directory object, including devices and pipes, are considered to be files. Symbolic links are resolved to their targets before checking their type.

This computation does not throw exceptions.

removeTree :: FilePath -> IO ()

Recursively remove a directory tree rooted at the given path.

This computation does not follow symlinks. If the tree contains symlinks, the links themselves will be removed, but not the objects they point to.

If the root path is a symlink, then it will be treated as if it were a regular directory.

This computation throws IOError on failure. See “Classifying I/O errors” in the System.IO.Error documentation for information on why the failure occured.

createTree :: FilePath -> IO ()

Create a directory at a given path, including any parents which might be missing.

This computation throws IOError on failure. See “Classifying I/O errors” in the System.IO.Error documentation for information on why the failure occured.

directory :: FilePath -> FilePath

Retrieves the FilePath’s directory. If the path is already a directory, it is returned unchanged.

rename :: FilePath -> FilePath -> IO ()

Rename a filesystem object.

This computation throws IOError on failure. See “Classifying I/O errors” in the System.IO.Error documentation for information on why the failure occured.

basename :: FilePath -> FilePath

Retrieve a FilePath’s basename component.

 basename "foo/bar.txt" == "bar"

toText :: FilePath -> Either Text Text

Attempt to convert a FilePath to human‐readable text.

If the path is decoded successfully, the result is a Right containing the decoded text. Successfully decoded text can be converted back to the original path using fromText.

If the path cannot be decoded, the result is a Left containing an approximation of the original path. If displayed to the user, this value should be accompanied by some warning that the path has an invalid encoding. Approximated text cannot be converted back to the original path.

This function ignores the user’s locale, and assumes all file paths are encoded in UTF8. If you need to display file paths with an unusual or obscure encoding, use encode and then decode them manually.

Since: 0.2

hasExtension :: FilePath -> Text -> Bool

Get whether a FilePath’s last extension is the predicate.

listDirectory :: FilePath -> IO [FilePath]

List objects in a directory, excluding "." and "..". Each returned FilePath includes the path of the directory. Entries are not sorted.

This computation throws IOError on failure. See “Classifying I/O errors” in the System.IO.Error documentation for information on why the failure occured.

decodeString :: String -> FilePath

Attempt to parse a FilePath from a string suitable for use with functions in System.IO. Do not use this function for parsing human‐readable paths, as the character set decoding is platform‐dependent. For converting human‐readable text to a FilePath, use fromText.

Since: 0.3.1

MVar

data MVar a

An MVar (pronounced "em-var") is a synchronising variable, used for communication between concurrent threads. It can be thought of as a a box, which may be empty or full.

Instances

newMVar :: a -> KIO (MVar a)Source

modifyMVar :: MVar a -> (a -> KIO (a, b)) -> KIO bSource

modifyMVar_ :: MVar a -> (a -> KIO a) -> KIO ()Source

swapMVar :: MVar a -> a -> KIO aSource

putMVar :: MVar a -> a -> KIO ()Source

IORef

data IORef a

A mutable variable in the IO monad

Instances

atomicModifyIORef :: IORef a -> (a -> (a, b)) -> KIO bSource

Chan

data Chan a

Chan is an abstract type representing an unbounded FIFO channel.

Instances

writeChan :: Chan a -> a -> KIO ()Source