Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
Synopsis
- data Bool
- data Char
- data Double
- data Float
- data Int
- data Word
- data Ordering
- data Maybe a
- class a ~# b => (a :: k) ~ (b :: k)
- data Integer
- class Show a where
- class Bounded a where
- class Enum a where
- succ :: a -> a
- toEnum :: Int -> a
- fromEnum :: a -> Int
- enumFrom :: a -> [a]
- enumFromThen :: a -> a -> [a]
- enumFromTo :: a -> a -> [a]
- enumFromThenTo :: a -> a -> a -> [a]
- class (Real a, Fractional a) => RealFrac a where
- class (Real a, Enum a) => Integral a where
- class Read a where
- data IO a
- class Eq a => Ord a where
- type String = [Char]
- type Rational = Ratio Integer
- class Num a => Fractional a where
- (/) :: a -> a -> a
- recip :: a -> a
- fromRational :: Rational -> a
- class (Num a, Ord a) => Real a where
- toRational :: a -> Rational
- class Eq a where
- class Functor (f :: Type -> Type) where
- class Applicative m => Monad (m :: Type -> Type) where
- data Either a b
- class Foldable (t :: Type -> Type) where
- foldMap :: Monoid m => (a -> m) -> t a -> m
- foldr :: (a -> b -> b) -> b -> t a -> b
- foldl :: (b -> a -> b) -> b -> t a -> b
- foldr1 :: (a -> a -> a) -> t a -> a
- foldl1 :: (a -> a -> a) -> t a -> a
- null :: t a -> Bool
- length :: t a -> Int
- elem :: Eq a => a -> t a -> Bool
- maximum :: Ord a => t a -> a
- minimum :: Ord a => t a -> a
- sum :: Num a => t a -> a
- product :: Num a => t a -> a
- class Monad m => MonadFail (m :: Type -> Type) where
- class (Functor t, Foldable t) => Traversable (t :: Type -> Type) where
- type IOError = IOException
- class Fractional a => Floating a where
- class Num a where
- class (RealFrac a, Floating a) => RealFloat a where
- floatRadix :: a -> Integer
- floatDigits :: a -> Int
- floatRange :: a -> (Int, Int)
- decodeFloat :: a -> (Integer, Int)
- encodeFloat :: Integer -> Int -> a
- exponent :: a -> Int
- significand :: a -> a
- scaleFloat :: Int -> a -> a
- isNaN :: a -> Bool
- isInfinite :: a -> Bool
- isDenormalized :: a -> Bool
- isNegativeZero :: a -> Bool
- isIEEE :: a -> Bool
- atan2 :: a -> a -> a
- type ShowS = String -> String
- type ReadS a = String -> [(a, String)]
- type FilePath = String
- realToFrac :: (Real a, Fractional b) => a -> b
- fromIntegral :: (Integral a, Num b) => a -> b
- ($) :: forall (r :: RuntimeRep) a (b :: TYPE r). (a -> b) -> a -> b
- otherwise :: Bool
- (++) :: [a] -> [a] -> [a]
- map :: (a -> b) -> [a] -> [b]
- filter :: (a -> Bool) -> [a] -> [a]
- id :: a -> a
- seq :: forall {r :: RuntimeRep} a (b :: TYPE r). a -> b -> b
- mapM_ :: (Foldable t, Monad m) => (a -> m b) -> t a -> m ()
- takeWhile :: (a -> Bool) -> [a] -> [a]
- take :: Int -> [a] -> [a]
- read :: Read a => String -> a
- (.) :: (b -> c) -> (a -> b) -> a -> c
- const :: a -> b -> a
- error :: forall (r :: RuntimeRep) (a :: TYPE r). HasCallStack => [Char] -> a
- zipWith :: (a -> b -> c) -> [a] -> [b] -> [c]
- even :: Integral a => a -> Bool
- fst :: (a, b) -> a
- uncurry :: (a -> b -> c) -> (a, b) -> c
- head :: HasCallStack => [a] -> a
- writeFile :: FilePath -> String -> IO ()
- getLine :: IO String
- putStrLn :: String -> IO ()
- cycle :: HasCallStack => [a] -> [a]
- concat :: Foldable t => t [a] -> [a]
- zip :: [a] -> [b] -> [(a, b)]
- print :: Show a => a -> IO ()
- (&&) :: Bool -> Bool -> Bool
- (||) :: Bool -> Bool -> Bool
- not :: Bool -> Bool
- errorWithoutStackTrace :: forall (r :: RuntimeRep) (a :: TYPE r). [Char] -> a
- undefined :: forall (r :: RuntimeRep) (a :: TYPE r). HasCallStack => a
- (=<<) :: Monad m => (a -> m b) -> m a -> m b
- flip :: (a -> b -> c) -> b -> a -> c
- ($!) :: forall (r :: RuntimeRep) a (b :: TYPE r). (a -> b) -> a -> b
- until :: (a -> Bool) -> (a -> a) -> a -> a
- asTypeOf :: a -> a -> a
- subtract :: Num a => a -> a -> a
- maybe :: b -> (a -> b) -> Maybe a -> b
- tail :: HasCallStack => [a] -> [a]
- last :: HasCallStack => [a] -> a
- init :: HasCallStack => [a] -> [a]
- scanl :: (b -> a -> b) -> b -> [a] -> [b]
- scanl1 :: (a -> a -> a) -> [a] -> [a]
- scanr :: (a -> b -> b) -> b -> [a] -> [b]
- scanr1 :: (a -> a -> a) -> [a] -> [a]
- iterate :: (a -> a) -> a -> [a]
- repeat :: a -> [a]
- replicate :: Int -> a -> [a]
- dropWhile :: (a -> Bool) -> [a] -> [a]
- drop :: Int -> [a] -> [a]
- splitAt :: Int -> [a] -> ([a], [a])
- span :: (a -> Bool) -> [a] -> ([a], [a])
- break :: (a -> Bool) -> [a] -> ([a], [a])
- reverse :: [a] -> [a]
- and :: Foldable t => t Bool -> Bool
- or :: Foldable t => t Bool -> Bool
- any :: Foldable t => (a -> Bool) -> t a -> Bool
- all :: Foldable t => (a -> Bool) -> t a -> Bool
- notElem :: (Foldable t, Eq a) => a -> t a -> Bool
- concatMap :: Foldable t => (a -> [b]) -> t a -> [b]
- (!!) :: HasCallStack => [a] -> Int -> a
- zip3 :: [a] -> [b] -> [c] -> [(a, b, c)]
- zipWith3 :: (a -> b -> c -> d) -> [a] -> [b] -> [c] -> [d]
- unzip :: [(a, b)] -> ([a], [b])
- unzip3 :: [(a, b, c)] -> ([a], [b], [c])
- shows :: Show a => a -> ShowS
- showChar :: Char -> ShowS
- showString :: String -> ShowS
- showParen :: Bool -> ShowS -> ShowS
- odd :: Integral a => a -> Bool
- (^^) :: (Fractional a, Integral b) => a -> b -> a
- gcd :: Integral a => a -> a -> a
- lcm :: Integral a => a -> a -> a
- snd :: (a, b) -> b
- curry :: ((a, b) -> c) -> a -> b -> c
- lex :: ReadS String
- readParen :: Bool -> ReadS a -> ReadS a
- either :: (a -> c) -> (b -> c) -> Either a b -> c
- reads :: Read a => ReadS a
- sequence_ :: (Foldable t, Monad m) => t (m a) -> m ()
- lines :: String -> [String]
- unlines :: [String] -> String
- words :: String -> [String]
- unwords :: [String] -> String
- userError :: String -> IOError
- ioError :: IOError -> IO a
- putChar :: Char -> IO ()
- putStr :: String -> IO ()
- getChar :: IO Char
- getContents :: IO String
- interact :: (String -> String) -> IO ()
- readFile :: FilePath -> IO String
- appendFile :: FilePath -> String -> IO ()
- readLn :: Read a => IO a
- readIO :: Read a => String -> IO a
- class Functor f => Applicative (f :: Type -> Type) where
- (<$>) :: Functor f => (a -> b) -> f a -> f b
- class Semigroup a => Monoid a where
- class Semigroup a where
- traverse :: (Traversable t, Applicative f) => (a -> f b) -> t a -> f (t b)
Documentation
Instances
The character type Char
is an enumeration whose values represent
Unicode (or equivalently ISO/IEC 10646) code points (i.e. characters, see
http://www.unicode.org/ for details). This set extends the ISO 8859-1
(Latin-1) character set (the first 256 characters), which is itself an extension
of the ASCII character set (the first 128 characters). A character literal in
Haskell has type Char
.
To convert a Char
to or from the corresponding Int
value defined
by Unicode, use toEnum
and fromEnum
from the
Enum
class respectively (or equivalently ord
and
chr
).
Instances
Double-precision floating point numbers. It is desirable that this type be at least equal in range and precision to the IEEE double-precision type.
Instances
Single-precision floating point numbers. It is desirable that this type be at least equal in range and precision to the IEEE single-precision type.
Instances
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
Instances
Instances
Monoid Ordering | Since: base-2.1 |
Semigroup Ordering | Since: base-4.9.0.0 |
Bounded Ordering | Since: base-2.1 |
Enum Ordering | Since: base-2.1 |
Generic Ordering | |
Ix Ordering | Since: base-2.1 |
Defined in GHC.Ix | |
Read Ordering | Since: base-2.1 |
Show Ordering | Since: base-2.1 |
Binary Ordering | |
NFData Ordering | |
Defined in Control.DeepSeq | |
Eq Ordering | |
Ord Ordering | |
Defined in GHC.Classes | |
Hashable Ordering | |
Defined in Data.Hashable.Class | |
() :=> (Monoid Ordering) | |
() :=> (Semigroup Ordering) | |
() :=> (Bounded Ordering) | |
() :=> (Enum Ordering) | |
() :=> (Read Ordering) | |
() :=> (Show Ordering) | |
type Rep Ordering | Since: base-4.6.0.0 |
The Maybe
type encapsulates an optional value. A value of type
either contains a value of type Maybe
aa
(represented as
),
or it is empty (represented as Just
aNothing
). 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.
Instances
MonadFail Maybe | Since: base-4.9.0.0 |
Defined in Control.Monad.Fail | |
Foldable Maybe | Since: base-2.1 |
Defined in Data.Foldable fold :: Monoid m => Maybe m -> m # foldMap :: Monoid m => (a -> m) -> Maybe a -> m # foldMap' :: Monoid m => (a -> m) -> Maybe a -> m # foldr :: (a -> b -> b) -> b -> Maybe a -> b # foldr' :: (a -> b -> b) -> b -> Maybe a -> b # foldl :: (b -> a -> b) -> b -> Maybe a -> b # foldl' :: (b -> a -> b) -> b -> Maybe a -> b # foldr1 :: (a -> a -> a) -> Maybe a -> a # foldl1 :: (a -> a -> a) -> Maybe a -> a # elem :: Eq a => a -> Maybe a -> Bool # maximum :: Ord a => Maybe a -> a # minimum :: Ord a => Maybe a -> a # | |
Eq1 Maybe | Since: base-4.9.0.0 |
Ord1 Maybe | Since: base-4.9.0.0 |
Defined in Data.Functor.Classes | |
Read1 Maybe | Since: base-4.9.0.0 |
Defined in Data.Functor.Classes | |
Show1 Maybe | Since: base-4.9.0.0 |
Traversable Maybe | Since: base-2.1 |
Alternative Maybe | Picks the leftmost Since: base-2.1 |
Applicative Maybe | Since: base-2.1 |
Functor Maybe | Since: base-2.1 |
Monad Maybe | Since: base-2.1 |
MonadPlus Maybe | Picks the leftmost Since: base-2.1 |
MonadFailure Maybe | |
NFData1 Maybe | Since: deepseq-1.4.3.0 |
Defined in Control.DeepSeq | |
MonadThrow Maybe | |
Defined in Control.Monad.Catch throwM :: (HasCallStack, Exception e) => e -> Maybe a # | |
Hashable1 Maybe | |
Defined in Data.Hashable.Class | |
Generic1 Maybe | |
() :=> (Alternative Maybe) | |
Defined in Data.Constraint ins :: () :- Alternative Maybe # | |
() :=> (Applicative Maybe) | |
Defined in Data.Constraint ins :: () :- Applicative Maybe # | |
() :=> (Functor Maybe) | |
() :=> (MonadPlus Maybe) | |
Lift a => Lift (Maybe a :: Type) | |
Semigroup a => Monoid (Maybe a) | Lift a semigroup into Since 4.11.0: constraint on inner Since: base-2.1 |
Semigroup a => Semigroup (Maybe a) | Since: base-4.9.0.0 |
Generic (Maybe a) | |
SingKind a => SingKind (Maybe a) | Since: base-4.9.0.0 |
Defined in GHC.Generics type DemoteRep (Maybe a) | |
Read a => Read (Maybe a) | Since: base-2.1 |
Show a => Show (Maybe a) | Since: base-2.1 |
Binary a => Binary (Maybe a) | |
NFData a => NFData (Maybe a) | |
Defined in Control.DeepSeq | |
Eq a => Eq (Maybe a) | Since: base-2.1 |
Ord a => Ord (Maybe a) | Since: base-2.1 |
Hashable a => Hashable (Maybe a) | |
Defined in Data.Hashable.Class | |
MonoFoldable (Maybe a) | |
Defined in Data.MonoTraversable ofoldMap :: Monoid m => (Element (Maybe a) -> m) -> Maybe a -> m # ofoldr :: (Element (Maybe a) -> b -> b) -> b -> Maybe a -> b # ofoldl' :: (a0 -> Element (Maybe a) -> a0) -> a0 -> Maybe a -> a0 # otoList :: Maybe a -> [Element (Maybe a)] # oall :: (Element (Maybe a) -> Bool) -> Maybe a -> Bool # oany :: (Element (Maybe a) -> Bool) -> Maybe a -> Bool # olength64 :: Maybe a -> Int64 # ocompareLength :: Integral i => Maybe a -> i -> Ordering # otraverse_ :: Applicative f => (Element (Maybe a) -> f b) -> Maybe a -> f () # ofor_ :: Applicative f => Maybe a -> (Element (Maybe a) -> f b) -> f () # omapM_ :: Applicative m => (Element (Maybe a) -> m ()) -> Maybe a -> m () # oforM_ :: Applicative m => Maybe a -> (Element (Maybe a) -> m ()) -> m () # ofoldlM :: Monad m => (a0 -> Element (Maybe a) -> m a0) -> a0 -> Maybe a -> m a0 # ofoldMap1Ex :: Semigroup m => (Element (Maybe a) -> m) -> Maybe a -> m # ofoldr1Ex :: (Element (Maybe a) -> Element (Maybe a) -> Element (Maybe a)) -> Maybe a -> Element (Maybe a) # ofoldl1Ex' :: (Element (Maybe a) -> Element (Maybe a) -> Element (Maybe a)) -> Maybe a -> Element (Maybe a) # headEx :: Maybe a -> Element (Maybe a) # lastEx :: Maybe a -> Element (Maybe a) # unsafeHead :: Maybe a -> Element (Maybe a) # unsafeLast :: Maybe a -> Element (Maybe a) # maximumByEx :: (Element (Maybe a) -> Element (Maybe a) -> Ordering) -> Maybe a -> Element (Maybe a) # minimumByEx :: (Element (Maybe a) -> Element (Maybe a) -> Ordering) -> Maybe a -> Element (Maybe a) # | |
MonoFunctor (Maybe a) | |
MonoPointed (Maybe a) | |
MonoTraversable (Maybe a) | |
SingI ('Nothing :: Maybe a) | Since: base-4.9.0.0 |
Defined in GHC.Generics | |
(Monoid a) :=> (Monoid (Maybe a)) | |
(Semigroup a) :=> (Semigroup (Maybe a)) | |
(Read a) :=> (Read (Maybe a)) | |
(Show a) :=> (Show (Maybe a)) | |
(Eq a) :=> (Eq (Maybe a)) | |
(Ord a) :=> (Ord (Maybe a)) | |
SingI a2 => SingI ('Just a2 :: Maybe a1) | Since: base-4.9.0.0 |
Defined in GHC.Generics | |
type Failure Maybe | |
Defined in Basement.Monad | |
type Rep1 Maybe | Since: base-4.6.0.0 |
type DemoteRep (Maybe a) | |
Defined in GHC.Generics | |
type Rep (Maybe a) | Since: base-4.6.0.0 |
Defined in GHC.Generics | |
data Sing (b :: Maybe a) | |
type Element (Maybe a) | |
Defined in Data.MonoTraversable |
class a ~# b => (a :: k) ~ (b :: k) infix 4 #
Lifted, homogeneous equality. By lifted, we mean that it
can be bogus (deferred type error). By homogeneous, the two
types a
and b
must have the same kinds.
Arbitrary precision integers. In contrast with fixed-size integral types
such as Int
, the Integer
type represents the entire infinite range of
integers.
Integers are stored in a kind of sign-magnitude form, hence do not expect two's complement form when using bit operations.
If the value is small (fit into an Int
), IS
constructor is used.
Otherwise Integer
and IN
constructors are used to store a BigNat
representing respectively the positive or the negative value magnitude.
Invariant: Integer
and IN
are used iff value doesn't fit in IS
Instances
Conversion of values to readable String
s.
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 thand
(associativity is ignored). Thus, ifd
is0
then the result is never surrounded in parentheses; ifd
is11
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,
produces the stringshow
(Leaf 1 :^: Leaf 2 :^: Leaf 3)"Leaf 1 :^: (Leaf 2 :^: Leaf 3)"
.
:: Int | the operator precedence of the enclosing
context (a number from |
-> a | the value to be converted to a |
-> ShowS |
Convert a value to a readable String
.
showsPrec
should satisfy the law
showsPrec d x r ++ s == showsPrec d x (r ++ s)
Derived instances of Read
and Show
satisfy the following:
That is, readsPrec
parses the string produced by
showsPrec
, and delivers the value that showsPrec
started with.