Safe Haskell | None |
---|---|
Language | Haskell2010 |
- data Handle :: *
- stdin :: Handle
- stdout :: Handle
- stderr :: Handle
- type Bytes = ByteString
- readBytes :: String -> IO Bytes
- writeBytes :: String -> Bytes -> IO ()
- readHBytes :: Handle -> IO Bytes
- writeHBytes :: Handle -> Bytes -> IO ()
- type Chunk = ByteString
- readChunk :: String -> IO Chunk
- writeChunk :: String -> Chunk -> IO ()
- readHChunk :: Handle -> IO Chunk
- writeHChunk :: Handle -> Chunk -> IO ()
- readString :: String -> IO String
- writeString :: String -> String -> IO ()
- readHString :: Handle -> IO String
- writeHString :: Handle -> String -> IO ()
- data Void
- type (:*:) a b = (a, b)
- type (:+:) a b = Either a b
- class Semigroup m where
- (+) :: m -> m -> m
- class Semigroup m => Monoid m where
- zero :: m
- class Monoid m => Disjonctive m where
- class Monoid m => Semiring m where
- (*) :: m -> m -> m
- class Semiring m => Ring m where
- one :: m
- class (Ring m, Disjonctive m) => Invertible m where
- class (Semigroup a, Semigroup b) => SubSemi a b where
- cast :: b -> a
- class Unit f where
- pure :: a -> f a
- newtype Endo k a = Endo {
- runEndo :: k a a
- newtype StrictEndo a = StrictEndo {
- runStrictEndo :: a -> a
- newtype Dual m = Dual {
- getDual :: m
- newtype Product a = Product {
- getProduct :: a
- newtype OrdList a = OrdList {
- getOrdList :: [a]
- newtype Interleave a = Interleave {
- interleave :: [a]
- newtype Accum a = Accum {}
- newtype Max a = Max {
- getMax :: a
- newtype Min a = Min {
- getMin :: a
- newtype Id a = Id {
- getId :: a
- class Deductive k where
- (.) :: k b c -> k a b -> k a c
- class Deductive k => Category k where
- id :: k a a
- (<<<) :: Category k => k b c -> k a b -> k a c
- (>>>) :: Category k => k a b -> k b c -> k a c
- (+++) :: Split k => (a -> k c c) -> (b -> k d d) -> (a :+: b) -> k (c, d) (c, d)
- class Category k => Choice k where
- class Category k => Split k where
- (<#>) :: k a c -> k b d -> k (a, b) (c, d)
- type Constraint a = a -> a
- c'listOf :: Constraint a -> Constraint [a]
- c'list :: Constraint [a]
- c'int :: Constraint Int
- c'char :: Constraint Char
- c'string :: Constraint String
- c'float :: Constraint Float
- c'_ :: Constraint a
- const :: Unit m => a -> m a
- (&) :: a -> (a -> b) -> b
- ($^) :: (a -> b -> c) -> b -> a -> c
- is :: a -> (a -> Bool) -> Bool
- fix :: (a -> a) -> a
- first :: Split k => k a b -> k (a, c) (b, c)
- second :: Split k => k a b -> k (c, a) (c, b)
- ifThenElse :: Bool -> a -> a -> a
- bool :: a -> a -> Bool -> a
- extreme :: Bounded a => Bool -> a
- guard :: (Unit m, Monoid (m ())) => Bool -> m ()
- fail :: String -> a
- unit :: Unit m => m ()
- when :: Unit m => Bool -> m () -> m ()
- unless :: Unit m => Bool -> m () -> m ()
- tailSafe :: [a] -> [a]
- headDef :: a -> [a] -> a
- fromMaybe :: a -> Maybe a -> a
- rmod :: (RealFloat m, Invertible m) => m -> m -> m
- inside :: Ord t => t -> t -> t -> Bool
- swap :: (a, b) -> (b, a)
- comparing :: Ord a => (b -> a) -> b -> b -> Ordering
- inOrder :: Ord t => t -> t -> (t, t, Bool)
- insertOrd :: Ord t => t -> [t] -> [t]
- invertOrd :: Ordering -> Ordering
- data Assoc k a = Assoc k a
- assoc :: a -> Assoc a a
- newtype Range a = Range (a, a)
- amb :: IO a -> IO a -> IO a
- unamb :: a -> a -> a
- module Prelude
- class IsString a where
- fromString :: String -> a
Raw data
data Handle :: *
Haskell defines operations to read and write characters from and to files,
represented by values of type Handle
. Each value of this type is a
handle: a record used by the Haskell run-time system to manage I/O
with file system objects. A handle has at least the following properties:
- whether it manages input or output or both;
- whether it is open, closed or semi-closed;
- whether the object is seekable;
- whether buffering is disabled, or enabled on a line or block basis;
- a buffer (whose length may be zero).
Most handles will also have a current I/O position indicating where the next
input or output operation will occur. A handle is readable if it
manages only input or both input and output; likewise, it is writable if
it manages only output or both input and output. A handle is open when
first allocated.
Once it is closed it can no longer be used for either input or output,
though an implementation cannot re-use its storage while references
remain to it. Handles are in the Show
and Eq
classes. The string
produced by showing a handle is system dependent; it should include
enough information to identify the handle for debugging. A handle is
equal according to ==
only to itself; no attempt
is made to compare the internal state of different handles for equality.
type Bytes = ByteString Source
writeBytes :: String -> Bytes -> IO () Source
readHBytes :: Handle -> IO Bytes Source
writeHBytes :: Handle -> Bytes -> IO () Source
type Chunk = ByteString Source
writeChunk :: String -> Chunk -> IO () Source
readHChunk :: Handle -> IO Chunk Source
writeHChunk :: Handle -> Chunk -> IO () Source
readString :: String -> IO String Source
writeString :: String -> String -> IO () Source
readHString :: Handle -> IO String Source
writeHString :: Handle -> String -> IO () Source
Basic union and product types
Monoid Void | |
Semigroup Void | |
Monoid a => SubSemi a Void | |
MonadError Void [] | |
MonadError Void Maybe | |
Isomorphic Bool Bool (Maybe a) (Maybe Void) | |
Isomorphic a b (Void, a) (Void, b) | |
Monad m => MonadError Void (ListT m) | |
Ord a => DataMap (Set a) a Void | |
Eq b => OrderedMap (Set a) a Void (Set b) b Void | |
Traversable m => Traversable (RWST Void w Void m) | |
Foldable m => Foldable (RWST Void w Void m) |
Basic group and ring structure
Classes
class Semigroup m where Source
The class of all types that have a binary operation. Note that the operation isn't necesarily commutative (in the case of lists, for example)
Nothing
class Semigroup m => Monoid m where Source
A monoid is a semigroup with a null element such that zero + a == a + zero == a
Nothing
class Monoid m => Disjonctive m where Source
Nothing
Disjonctive Bool | |
Disjonctive Double | |
Disjonctive Float | |
Disjonctive Int | |
Disjonctive Integer | |
Disjonctive Rational | |
Ord a => Disjonctive (Set a) | |
Ord k => Disjonctive (Map k a) | |
(Disjonctive a, Disjonctive b) => Disjonctive ((:*:) a b) | |
(Ord a, Ord b) => Disjonctive (Bimap a b) |
class Monoid m => Semiring m where Source
Nothing
Semiring Bool | |
Semiring Double | |
Semiring Float | |
Semiring Int | |
Semiring Integer | |
Semiring Rational | |
Monoid a => Semiring [a] | |
Ord a => Semiring (Set a) | |
Semiring m => Semiring (Dual m) | |
(Ord a, Bounded a) => Semiring (Min a) | |
(Ord a, Bounded a) => Semiring (Max a) | |
Semiring b => Semiring (a -> b) | |
(Ord k, Semigroup a) => Semiring (Map k a) | |
(Semiring a, Semiring b) => Semiring ((:*:) a b) | |
Semiring (f a) => Semiring (Backwards f a) | |
Semigroup a => Semiring (LogicT m a) | |
(Ord a, Ord b) => Semiring (Relation a b) | |
(Ord a, Ord b, Semigroup a, Semigroup b) => Semiring (Bimap a b) | |
Semiring (m (a, s, Void)) => Semiring (StateT s m a) | |
Semiring (m (a, Void, Void)) => Semiring (ReaderT r m a) | |
Semiring (m (a, Void, w)) => Semiring (WriterT w m a) | |
Semiring (m (a, s, w)) => Semiring (RWST r w s m a) |
class Semiring m => Ring m where Source
Nothing
Ring Bool | |
Ring Double | |
Ring Float | |
Ring Int | |
Ring Integer | |
Ring Rational | |
Monoid a => Ring [a] | |
Ring m => Ring (Dual m) | |
(Ord a, Bounded a) => Ring (Min a) | |
(Ord a, Bounded a) => Ring (Max a) | |
Ring b => Ring (a -> b) | |
(Ring a, Ring b) => Ring ((:*:) a b) | |
Ring (f a) => Ring (Backwards f a) | |
Monoid a => Ring (LogicT m a) | |
Ring (m (a, s, Void)) => Ring (StateT s m a) | |
Ring (m (a, Void, Void)) => Ring (ReaderT r m a) | |
Ring (m (a, Void, w)) => Ring (WriterT w m a) | |
Ring (m (a, s, w)) => Ring (RWST r w s m a) |
class (Ring m, Disjonctive m) => Invertible m where Source
Nothing
Unit [] | |
Unit IO | |
Unit Maybe | |
Unit Tree | |
Unit Interleave | |
Unit Range | |
Unit OrdList | |
Unit Id | |
Unit Accum | |
Unit Strict | |
Unit TimeVal | |
Unit ((->) b) | |
Unit (Either a) | |
Monoid w => Unit ((,) w) | |
Monoid k => Unit (Assoc k) | |
Monoid k => Unit (Increasing k) | |
Monoid a => Unit (Const a) | |
Unit f => Unit (Backwards f) | |
Unit (Zip []) | |
Ord k => Unit (Zip (Map k)) | |
Unit (Zip Tree) | |
Unit (ContT m) | |
Unit m => Unit (StrictT m) | |
Unit m => Unit (MaybeT m) | |
Unit m => Unit (TreeT m) | |
Unit m => Unit (ListT m) | |
Unit m => Unit (Cofree m) | |
Unit (Free f) | |
Unit (LogicT m) | |
(Unit f, Unit g) => Unit ((:**:) f g) | |
(Unit f, Unit g) => Unit ((:.:) f g) | |
(Unit f, Unit g) => Unit (Compose' f g) | |
Unit m => Unit (StateT s m) | |
Unit m => Unit (ReaderT r m) | |
(Unit m, Monoid w) => Unit (WriterT w m) | |
Unit m => Unit (EitherT e m) | |
(Unit m, Ring t) => Unit (ProbT t m) | |
(Unit m, Monoid w) => Unit (CounterT w acc m) | |
(Unit f, Monoid w) => Unit (RWST r w s f) |
Common monoids
Control monoids
A monoid on category endomorphisms under composition
Meta-monoids
The dual of a monoid is the same as the original, with arguments reversed
The Product monoid
Product | |
|
Accumulating monoids
An ordered list. The semigroup instance merges two lists so that the result remains in ascending order.
OrdList | |
|
newtype Interleave a Source
Interleave | |
|
A monoid on Maybes, where the sum is the leftmost non-Nothing value.
The Max monoid, where (+) =~ max
The Min monoid, where (+) =~ min
The Identity Functor
Fundamental control operations
Splitting and Choosing
Expression-level type constraints
type Constraint a = a -> a Source
c'listOf :: Constraint a -> Constraint [a] Source
c'list :: Constraint [a] Source
c'int :: Constraint Int Source
c'_ :: Constraint a Source
Miscellaneous functions
ifThenElse :: Bool -> a -> a -> a Source
rmod :: (RealFloat m, Invertible m) => m -> m -> m infixl 7 Source
Lazily ordering values
comparing :: Ord a => (b -> a) -> b -> b -> Ordering
comparing p x y = compare (p x) (p y)
Useful combinator for use in conjunction with the xxxBy
family
of functions from Data.List, for example:
... sortBy (comparing fst) ...
Assoc k a |
Ranges
A range of shape (min,max) of ordered values.
Such ranges may be multiplied to create n-dimensional ranges for which equivalence means sharing an n-dimensional subrange. They may be very useful in creating Maps that partition an n-dimensional space in which we may query for subrange membership with logarithmic complexity for any point P (a point is a subrange of volume 0, or `(pure x0,...,pure xn) where (x0,..,xn) = p`).
Indeed, a point is equivalent to a range iff it belongs to that range.
Range (a, a) |
Parallel short-circuit evaluation
The rest is imported from the Prelude
module Prelude
class IsString a where
Class for string-like datastructures; used by the overloaded string extension (-XOverloadedStrings in GHC).
fromString :: String -> a