- data Text
- type String = Text
- class Monad m where
- data Maybe a
- data Bool
- ($) :: (a -> b) -> a -> b
- (.) :: (b -> c) -> (a -> b) -> a -> c
- data LogMessage
- = ProcessCreated FilePath
- | InvalidBundle FilePath SomeException
- | ProcessDidNotStart FilePath
- | ExceptionThrown Text SomeException
- | RemovingPort Int
- | UnpackingBundle FilePath FilePath
- | TerminatingApp Text
- | FinishedReloading Text
- | TerminatingOldProcess Text
- | RemovingOldFolder FilePath
- | ReceivedInotifyEvent Text
- | ProcessWaiting FilePath
- log :: LogMessage -> KIO ()
- logEx :: Q Exp
- data KIO a
- toString :: ToString a => a -> String
- map :: (a -> b) -> [a] -> [b]
- (***) :: Arrow a => forall b c b' c'. a b c -> a b' c' -> a (b, b') (c, c')
- readFileLBS :: FilePath -> KIO (Either SomeException ByteString)
- data Either a b
- either :: (a -> c) -> (b -> c) -> Either a b -> c
- data SomeException
- runKIO :: (LogMessage -> IO ()) -> KIO a -> IO a
- void :: Monad m => m a -> m ()
- liftIO :: IO a -> KIO (Either SomeException a)
- forkKIO :: KIO () -> KIO ()
- forkKIO' :: KIO () -> KIO (Either SomeException ThreadId)
- (++) :: Monoid m => m -> m -> m
- minBound :: Bounded a => a
- succ :: Enum a => a -> a
- show :: Show a => a -> Text
- when :: Monad m => Bool -> m () -> m ()
- fromText :: FromText a => Text -> a
- flip :: (a -> b -> c) -> b -> a -> c
- class Show a
- data KeterException
- toException :: Exception e => e -> SomeException
- newStdGen :: KIO StdGen
- class Default a where
- def :: a
- data Int
- (&&) :: Bool -> Bool -> Bool
- (==) :: Eq a => a -> a -> Bool
- (/=) :: Eq a => a -> a -> Bool
- (*) :: Num a => a -> a -> a
- fromIntegral :: (Integral a, Num b) => a -> b
- reverse :: [a] -> [a]
- otherwise :: Bool
- timeout :: Int -> KIO a -> KIO (Maybe a)
- threadDelay :: Int -> KIO ()
- id :: a -> a
- filter :: (a -> Bool) -> [a] -> [a]
- mapM_ :: Monad m => (a -> m b) -> [a] -> m ()
- fmap :: Functor f => forall a b. (a -> b) -> f a -> f b
- not :: Bool -> Bool
- maybe :: b -> (a -> b) -> Maybe a -> b
- (>) :: 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
- getCurrentTime :: KIO UTCTime
- (</>) :: FilePath -> FilePath -> FilePath
- (<.>) :: FilePath -> Text -> FilePath
- data FilePath
- isDirectory :: FilePath -> IO Bool
- isFile :: FilePath -> IO Bool
- removeTree :: FilePath -> IO ()
- createTree :: FilePath -> IO ()
- directory :: FilePath -> FilePath
- rename :: FilePath -> FilePath -> IO ()
- basename :: FilePath -> FilePath
- toText :: FilePath -> Either Text Text
- hasExtension :: FilePath -> Text -> Bool
- listDirectory :: FilePath -> IO [FilePath]
- decodeString :: String -> FilePath
- data MVar a
- newMVar :: a -> KIO (MVar a)
- newEmptyMVar :: KIO (MVar a)
- modifyMVar :: MVar a -> (a -> KIO (a, b)) -> KIO b
- modifyMVar_ :: MVar a -> (a -> KIO a) -> KIO ()
- swapMVar :: MVar a -> a -> KIO a
- takeMVar :: MVar a -> KIO a
- putMVar :: MVar a -> a -> KIO ()
- data IORef a
- newIORef :: a -> KIO (IORef a)
- atomicModifyIORef :: IORef a -> (a -> (a, b)) -> KIO b
- data Chan a
- newChan :: KIO (Chan a)
- readChan :: Chan a -> KIO a
- writeChan :: Chan a -> a -> KIO ()
A space efficient, packed, unboxed Unicode text type.
|ToJSON v => ToJSON (HashMap Text v)|
|ToJSON v => ToJSON (Map Text v)|
|FromJSON v => FromJSON (HashMap Text v)|
|FromJSON v => FromJSON (Map Text v)|
class Monad m where
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.
do expressions provide a convenient syntax for writing
Monad should satisfy the following laws:
return a >>= k == k a m >>= return == m m >>= (\x -> k x >>= h) == (m >>= k) >>= h
fmap f xs == xs >>= return . f
(>>=) :: 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 with a message. This operation is not part of the
mathematical definition of a monad, but is invoked on pattern-match
failure in a
|Monad ((->) r)|
|Monad (Either e)|
|Monad (ST s)|
|ArrowApply a => Monad (ArrowMonad a)|
|Monad m => Monad (Finalize m)|
|Monad m => Monad (ResourceT m)|
|Monad m => Monad (ExceptionT m)|
|Monad m => Monad (PErrorT m)|
|Monad (Partial e)|
|(Monad m, Error e) => Monad (ErrorT e m)|
|Monad m => Monad (StateT s m)|
|Monad m => Monad (Pipe i o m)|
data Maybe a
Maybe type encapsulates an optional value. A value of type
either contains a value of type
a (represented as
or it is empty (represented as
Maybe is a good way to
deal with errors or exceptional cases without resorting to drastic
measures such as
|MonadBase Maybe Maybe|
|MonadBaseControl Maybe Maybe|
|Eq a => Eq (Maybe a)|
|Ord a => Ord (Maybe a)|
|Show a => Show (Maybe a)|
|Generic (Maybe a)|
|ToJSON a => ToJSON (Maybe a)|
|FromJSON a => FromJSON (Maybe a)|
|Monoid a => Monoid (Maybe a)|
Lift a semigroup into
|Default (Maybe a)|
|Hashable a => Hashable (Maybe a)|
|Lift a => Lift (Maybe a)|
($) :: (a -> b) -> a -> b
Application operator. This operator is redundant, since ordinary
(f x) means the same as
(f . However,
low, right-associative binding precedence, so it sometimes allows
parentheses to be omitted; for example:
f $ g $ h x = f (g (h x))
(.) :: (b -> c) -> (a -> b) -> a -> c
map :: (a -> b) -> [a] -> [b]
f xs is the list obtained by applying
f to each element
map f [x1, x2, ..., xn] == [f x1, f x2, ..., f xn] map f [x1, x2, ...] == [f x1, f x2, ...]
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
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").
|Monad (Either e)|
|Functor (Either a)|
|Error e => MonadPlus (Either e)|
|Applicative (Either e)|
|Error e => Alternative (Either e)|
|MonadBase (Either e) (Either e)|
|MonadBaseControl (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)|
|Generic (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)|
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
Conditional execution of monadic expressions. For example,
when debug (putStr "Debugging\n")
will output the string
Debugging\n if the Boolean value
and otherwise do nothing.
flip :: (a -> b -> c) -> b -> a -> c
takes its (first) two arguments in the reverse order of
class Show a
Conversion of values to readable
- The result of
showis 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
showsPrecwill produce infix applications of the constructor.
- the representation will be enclosed in parentheses if the
precedence of the top-level constructor in
xis less than
d(associativity is ignored). Thus, if
0then the result is never surrounded in parentheses; if
11it is always surrounded in parentheses, unless it is an atomic expression.
- If the constructor is defined using record syntax, then
showwill 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,
produces the string
show(Leaf 1 :^: Leaf 2 :^: Leaf 3)
"Leaf 1 :^: (Leaf 2 :^: Leaf 3)".
class Default a where
A class for types with a default value.
def :: a
The default value for this type.
|Integral a => Default (Ratio a)|
|Default a => Default (IO a)|
|Default (Maybe a)|
|(Default a, RealFloat a) => Default (Complex a)|
|Default a => Default (Dual a)|
|Default (Endo a)|
|Num a => Default (Sum a)|
|Num a => Default (Product a)|
|Default (First a)|
|Default (Last a)|
|Default a => Default (Tree a)|
|Default (Seq a)|
|Default (IntMap v)|
|Default (Set v)|
|Default (DList a)|
|Default r => Default (e -> r)|
|(Default a, Default b) => Default (a, b)|
|Default (Map k v)|
|(Default a, Default b, Default c) => Default (a, b, c)|
|(Default a, Default b, Default c, Default d) => Default (a, b, c, d)|
|(Default a, Default b, Default c, Default d, Default e) => Default (a, b, c, d, e)|
id :: 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]
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.
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.
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.
FilePath’s directory. If the path is already a
directory, it is returned unchanged.
FilePath’s basename component.
basename "foo/bar.txt" == "bar"
Attempt to convert a
FilePath to human‐readable text.
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.
data MVar a
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.
data Chan a
Chan is an abstract type representing an unbounded FIFO channel.