| Safe Haskell | None |
|---|
Language.Fay.Prelude
- data Fay a
- data Char
- type String = [Char]
- data Integer
- data Double
- data Int
- data Bool
- class Show a
- class Read a
- data Maybe a
- class Typeable a where
- class Typeable a => Data a where
- gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> a -> c a
- gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c a
- toConstr :: a -> Constr
- dataTypeOf :: a -> DataType
- dataCast1 :: Typeable1 t => (forall d. Data d => c (t d)) -> Maybe (c a)
- dataCast2 :: Typeable2 t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c a)
- gmapT :: (forall b. Data b => b -> b) -> a -> a
- gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> a -> r
- gmapQr :: (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> a -> r
- gmapQ :: (forall d. Data d => d -> u) -> a -> [u]
- gmapQi :: Int -> (forall d. Data d => d -> u) -> a -> u
- gmapM :: Monad m => (forall d. Data d => d -> m d) -> a -> m a
- gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> a -> m a
- gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> a -> m a
- class Monad m
- class Eq a where
- read :: Read a => String -> a
- (>>) :: Fay a -> Fay b -> Fay b
- (>>=) :: Fay a -> (a -> Fay b) -> Fay b
- (+) :: Num a => a -> a -> a
- (*) :: Num a => a -> a -> a
- (-) :: Num a => a -> a -> a
- (>) :: Ord a => a -> a -> Bool
- (<) :: Ord a => a -> a -> Bool
- (>=) :: Ord a => a -> a -> Bool
- (<=) :: Ord a => a -> a -> Bool
- (/) :: Fractional a => a -> a -> a
- (||) :: Bool -> Bool -> Bool
- (&&) :: Bool -> Bool -> Bool
- fail :: String -> Fay a
- return :: a -> Fay a
- force :: a -> Bool -> Fay a
- ($) :: (t1 -> t) -> t1 -> t
- ($!) :: (a -> b) -> a -> b
- (!!) :: [a] -> Int -> a
- (++) :: [a] -> [a] -> [a]
- (.) :: (t1 -> t) -> (t2 -> t1) -> t2 -> t
- (=<<) :: Monad m => (a -> m b) -> m a -> m b
- (**) :: Double -> Double -> Double
- (^^) :: Double -> Int -> Double
- (^) :: Num a => a -> Int -> a
- data Either a b
- data Ordering
- abs :: (Num a, Ord a) => a -> a
- acos :: Double -> Double
- acosh :: Double -> Double
- all :: (a -> Bool) -> [a] -> Bool
- and :: [Bool] -> Bool
- any :: (a -> Bool) -> [a] -> Bool
- asin :: Double -> Double
- asinh :: Double -> Double
- asTypeOf :: a -> a -> a
- atan :: Double -> Double
- atanh :: Double -> Double
- break :: (a -> Bool) -> [a] -> ([a], [a])
- ceiling :: Double -> Int
- compare :: Ord a => a -> a -> Ordering
- concat :: [[a]] -> [a]
- concatMap :: (a -> [b]) -> [a] -> [b]
- const :: a -> b -> a
- cos :: Double -> Double
- cosh :: Double -> Double
- curry :: ((a, b) -> c) -> a -> b -> c
- cycle :: [a] -> [a]
- div :: Int -> Int -> Int
- divMod :: Int -> Int -> (Int, Int)
- drop :: Int -> [a] -> [a]
- dropWhile :: (a -> Bool) -> [a] -> [a]
- either :: (a -> c) -> (b -> c) -> Either a b -> c
- elem :: Eq a => a -> [a] -> Bool
- enumFrom :: Num a => a -> [a]
- enumFromThen :: Num t => t -> t -> [t]
- enumFromThenTo :: (Ord t, Num t) => t -> t -> t -> [t]
- enumFromTo :: (Ord t, Num t) => t -> t -> [t]
- error :: String -> a
- even :: Int -> Bool
- exp :: Double -> Double
- filter :: (a -> Bool) -> [a] -> [a]
- find :: (a -> Bool) -> [a] -> Maybe a
- flip :: (t1 -> t2 -> t) -> t2 -> t1 -> t
- floor :: Double -> Int
- foldl :: (t1 -> t -> t1) -> t1 -> [t] -> t1
- foldl1 :: (a -> a -> a) -> [a] -> a
- foldr :: (t -> t1 -> t1) -> t1 -> [t] -> t1
- foldr1 :: (a -> a -> a) -> [a] -> a
- forM_ :: Monad m => [t] -> (t -> m a) -> m ()
- fromInteger :: a -> a
- fromIntegral :: Int -> Double
- fromRational :: a -> a
- fst :: (t, t1) -> t
- gcd :: Int -> Int -> Int
- head :: [a] -> a
- id :: a -> a
- init :: [a] -> [a]
- insertBy :: (a -> a -> Ordering) -> a -> [a] -> [a]
- intercalate :: [a] -> [[a]] -> [a]
- intersperse :: a -> [a] -> [a]
- iterate :: (a -> a) -> a -> [a]
- last :: [a] -> a
- lcm :: Int -> Int -> Int
- length :: [a] -> Int
- lines :: String -> [String]
- log :: Double -> Double
- logBase :: Double -> Double -> Double
- lookup :: Eq a1 => a1 -> [(a1, a)] -> Maybe a
- map :: (a -> b) -> [a] -> [b]
- mapM_ :: Monad m => (a -> m b) -> [a] -> m ()
- max :: (Num a, Foreign a) => a -> a -> a
- maximum :: (Num a, Foreign a) => [a] -> a
- maybe :: t -> (t1 -> t) -> Maybe t1 -> t
- min :: (Num a, Foreign a) => a -> a -> a
- minimum :: (Num a, Foreign a) => [a] -> a
- mod :: Int -> Int -> Int
- negate :: Num a => a -> a
- not :: Bool -> Bool
- notElem :: Eq a => a -> [a] -> Bool
- nub :: Eq a => [a] -> [a]
- null :: [t] -> Bool
- odd :: Int -> Bool
- or :: [Bool] -> Bool
- otherwise :: Bool
- pi :: Double
- pred :: Num a => a -> a
- prependToAll :: a -> [a] -> [a]
- print :: Foreign a => Automatic a -> Fay ()
- product :: Num a => [a] -> a
- properFraction :: Double -> (Int, Double)
- putStrLn :: String -> Fay ()
- quot :: Int -> Int -> Int
- quotRem :: Int -> Int -> (Int, Int)
- recip :: Double -> Double
- rem :: Int -> Int -> Int
- repeat :: a -> [a]
- replicate :: Int -> a -> [a]
- reverse :: [a] -> [a]
- round :: Double -> Int
- scanl :: (a -> b -> a) -> a -> [b] -> [a]
- scanl1 :: (a -> a -> a) -> [a] -> [a]
- scanr :: (a -> b -> b) -> b -> [a] -> [b]
- scanr1 :: (a -> a -> a) -> [a] -> [a]
- seq :: a -> b -> b
- sequence :: Monad m => [m a] -> m [a]
- sequence_ :: Monad m => [m a] -> m ()
- show :: (Foreign a, Show a) => Automatic a -> String
- signum :: (Num a, Ord a) => a -> a
- sin :: Double -> Double
- sinh :: Double -> Double
- snd :: (t, t1) -> t1
- sort :: Ord a => [a] -> [a]
- sortBy :: (t -> t -> Ordering) -> [t] -> [t]
- span :: (a -> Bool) -> [a] -> ([a], [a])
- splitAt :: Int -> [a] -> ([a], [a])
- sqrt :: Double -> Double
- subtract :: Num a => a -> a -> a
- succ :: Num a => a -> a
- sum :: Num a => [a] -> a
- tail :: [a] -> [a]
- take :: Int -> [a] -> [a]
- takeWhile :: (a -> Bool) -> [a] -> [a]
- tan :: Double -> Double
- tanh :: Double -> Double
- truncate :: Double -> Int
- uncurry :: (a -> b -> c) -> (a, b) -> c
- undefined :: a
- unlines :: [String] -> String
- until :: (a -> Bool) -> (a -> a) -> a -> a
- unwords :: [String] -> String
- unzip :: [(a, b)] -> ([a], [b])
- unzip3 :: [(a, b, c)] -> ([a], [b], [c])
- when :: Monad m => Bool -> m a -> m ()
- words :: String -> [String]
- zip :: [a] -> [b] -> [(a, b)]
- zip3 :: [a] -> [b] -> [c] -> [(a, b, c)]
- zipWith :: (a -> b -> c) -> [a] -> [b] -> [c]
- zipWith3 :: (a -> b -> c -> d) -> [a] -> [b] -> [c] -> [d]
Documentation
The JavaScript FFI interfacing monad.
data Char
The character type Char is an enumeration whose values represent
Unicode (or equivalently ISO/IEC 10646) 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
| Bounded Char | |
| Enum Char | |
| Eq Char | |
| Data Char | |
| Ord Char | |
| Read Char | |
| Show Char | |
| Ix Char | |
| Typeable Char | |
| ToJSON Char | |
| FromJSON Char | |
| Hashable Char | |
| ErrorList Char | |
| Unbox Char | |
| Printable String | |
| Foreign Char | Characters are OK. |
| Vector Vector Char | |
| MVector MVector Char | |
| Monad m => Stream ByteString m Char | |
| Monad m => Stream ByteString m Char | |
| IsString [Char] | |
| ToJSON [Char] | |
| FromJSON [Char] | |
| ToJSON v => ToJSON (HashMap String v) | |
| ToJSON v => ToJSON (Map String v) | |
| FromJSON v => FromJSON (HashMap String v) | |
| FromJSON v => FromJSON (Map String v) |
data Integer
Arbitrary-precision integers.
data Double
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
| Enum Double | |
| Eq Double | |
| Floating Double | |
| Fractional Double | |
| Data Double | |
| Num Double | |
| Ord Double | |
| Read Double | |
| Real Double | |
| RealFloat Double | |
| RealFrac Double | |
| Show Double | |
| Typeable Double | |
| ToJSON Double | |
| FromJSON Double | |
| Default Double | |
| Hashable Double | |
| Unbox Double | |
| Foreign Double | All numbers in JS are double. |
| Vector Vector Double | |
| MVector MVector Double |
data Int
data Bool
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
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 thand(associativity is ignored). Thus, ifdis0then the result is never surrounded in parentheses; ifdis11it 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 stringshow(Leaf 1 :^: Leaf 2 :^: Leaf 3)"Leaf 1 :^: (Leaf 2 :^: Leaf 3)".
Instances
class Read a
Parsing of Strings, producing values.
Minimal complete definition: readsPrec (or, for GHC only, readPrec)
Derived instances of Read make the following assumptions, which
derived instances of Show obey:
- If the constructor is defined to be an infix operator, then the
derived
Readinstance will parse only infix applications of the constructor (not the prefix form). - Associativity is not used to reduce the occurrence of parentheses, although precedence may be.
- If the constructor is defined using record syntax, the derived
Readwill parse only the record-syntax form, and furthermore, the fields must be given in the same order as the original declaration. - The derived
Readinstance allows arbitrary Haskell whitespace between tokens of the input string. Extra parentheses are also allowed.
For example, given the declarations
infixr 5 :^: data Tree a = Leaf a | Tree a :^: Tree a
the derived instance of Read in Haskell 98 is equivalent to
instance (Read a) => Read (Tree a) where
readsPrec d r = readParen (d > app_prec)
(\r -> [(Leaf m,t) |
("Leaf",s) <- lex r,
(m,t) <- readsPrec (app_prec+1) s]) r
++ readParen (d > up_prec)
(\r -> [(u:^:v,w) |
(u,s) <- readsPrec (up_prec+1) r,
(":^:",t) <- lex s,
(v,w) <- readsPrec (up_prec+1) t]) r
where app_prec = 10
up_prec = 5
Note that right-associativity of :^: is unused.
The derived instance in GHC is equivalent to
instance (Read a) => Read (Tree a) where
readPrec = parens $ (prec app_prec $ do
Ident "Leaf" <- lexP
m <- step readPrec
return (Leaf m))
+++ (prec up_prec $ do
u <- step readPrec
Symbol ":^:" <- lexP
v <- step readPrec
return (u :^: v))
where app_prec = 10
up_prec = 5
readListPrec = readListPrecDefault
Instances
| Read Bool | |
| Read Char | |
| Read Double | |
| Read Float | |
| Read Int | |
| Read Int8 | |
| Read Int16 | |
| Read Int32 | |
| Read Int64 | |
| Read Integer | |
| Read Ordering | |
| Read Word | |
| Read Word8 | |
| Read Word16 | |
| Read Word32 | |
| Read Word64 | |
| Read () | |
| Read ByteString | |
| Read Text | |
| Read UTCTime | |
| Read DotNetTime | |
| Read ByteString | |
| Read Version | |
| Read ExitCode | |
| Read BufferMode | |
| Read Newline | |
| Read NewlineMode | |
| Read All | |
| Read Any | |
| Read GeneralCategory | |
| Read Lexeme | |
| Read Text | |
| Read Permissions | |
| Read Extension | |
| Read LocalTime | |
| Read ZonedTime | |
| Read TimeOfDay | |
| Read TimeZone | |
| Read Day | |
| Read SerializeContext | |
| Read a => Read [a] | |
| (Integral a, Read a) => Read (Ratio a) | |
| Read a => Read (Maybe a) | |
| Read a => Read (Dual a) | |
| Read a => Read (Sum a) | |
| Read a => Read (Product a) | |
| Read a => Read (First a) | |
| Read a => Read (Last a) | |
| (Read a, Ord a) => Read (Set a) | |
| Read a => Read (Vector a) | |
| (Read a, Unbox a) => Read (Vector a) | |
| (Read a, Read b) => Read (Either a b) | |
| (Read a, Read b) => Read (a, b) | |
| (Ord k, Read k, Read e) => Read (Map k e) | |
| (Ix a, Read a, Read b) => Read (Array a b) | |
| (Read a, Read b, Read c) => Read (a, b, c) | |
| (Read a, Read b, Read c, Read d) => Read (a, b, c, d) | |
| (Read a, Read b, Read c, Read d, Read e) => Read (a, b, c, d, e) | |
| (Read a, Read b, Read c, Read d, Read e, Read f) => Read (a, b, c, d, e, f) | |
| (Read a, Read b, Read c, Read d, Read e, Read f, Read g) => Read (a, b, c, d, e, f, g) | |
| (Read a, Read b, Read c, Read d, Read e, Read f, Read g, Read h) => Read (a, b, c, d, e, f, g, h) | |
| (Read a, Read b, Read c, Read d, Read e, Read f, Read g, Read h, Read i) => Read (a, b, c, d, e, f, g, h, i) | |
| (Read a, Read b, Read c, Read d, Read e, Read f, Read g, Read h, Read i, Read j) => Read (a, b, c, d, e, f, g, h, i, j) | |
| (Read a, Read b, Read c, Read d, Read e, Read f, Read g, Read h, Read i, Read j, Read k) => Read (a, b, c, d, e, f, g, h, i, j, k) | |
| (Read a, Read b, Read c, Read d, Read e, Read f, Read g, Read h, Read i, Read j, Read k, Read l) => Read (a, b, c, d, e, f, g, h, i, j, k, l) | |
| (Read a, Read b, Read c, Read d, Read e, Read f, Read g, Read h, Read i, Read j, Read k, Read l, Read m) => Read (a, b, c, d, e, f, g, h, i, j, k, l, m) | |
| (Read a, Read b, Read c, Read d, Read e, Read f, Read g, Read h, Read i, Read j, Read k, Read l, Read m, Read n) => Read (a, b, c, d, e, f, g, h, i, j, k, l, m, n) | |
| (Read a, Read b, Read c, Read d, Read e, Read f, Read g, Read h, Read i, Read j, Read k, Read l, Read m, Read n, Read o) => Read (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o) |
data Maybe a
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
| Monad Maybe | |
| Functor Maybe | |
| Typeable1 Maybe | |
| MonadPlus Maybe | |
| Applicative Maybe | |
| Alternative Maybe | |
| Eq a => Eq (Maybe a) | |
| (Typeable (Maybe a), Data a) => Data (Maybe a) | |
| (Eq (Maybe a), Ord a) => Ord (Maybe a) | |
| Read a => Read (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 |
| Default (Maybe a) | |
| Hashable a => Hashable (Maybe a) | |
| Foreign a => Foreign (Maybe a) | Maybes are pretty common. |
class Typeable a where
The class Typeable allows a concrete representation of a type to
be calculated.
Methods
Instances
class Typeable a => Data a where
The Data class comprehends a fundamental primitive gfoldl for
folding over constructor applications, say terms. This primitive can
be instantiated in several ways to map over the immediate subterms
of a term; see the gmap combinators later in this class. Indeed, a
generic programmer does not necessarily need to use the ingenious gfoldl
primitive but rather the intuitive gmap combinators. The gfoldl
primitive is completed by means to query top-level constructors, to
turn constructor representations into proper terms, and to list all
possible datatype constructors. This completion allows us to serve
generic programming scenarios like read, show, equality, term generation.
The combinators gmapT, gmapQ, gmapM, etc are all provided with
default definitions in terms of gfoldl, leaving open the opportunity
to provide datatype-specific definitions.
(The inclusion of the gmap combinators as members of class Data
allows the programmer or the compiler to derive specialised, and maybe
more efficient code per datatype. Note: gfoldl is more higher-order
than the gmap combinators. This is subject to ongoing benchmarking
experiments. It might turn out that the gmap combinators will be
moved out of the class Data.)
Conceptually, the definition of the gmap combinators in terms of the
primitive gfoldl requires the identification of the gfoldl function
arguments. Technically, we also need to identify the type constructor
c for the construction of the result type from the folded term type.
In the definition of gmapQx combinators, we use phantom type
constructors for the c in the type of gfoldl because the result type
of a query does not involve the (polymorphic) type of the term argument.
In the definition of gmapQl we simply use the plain constant type
constructor because gfoldl is left-associative anyway and so it is
readily suited to fold a left-associative binary operation over the
immediate subterms. In the definition of gmapQr, extra effort is
needed. We use a higher-order accumulation trick to mediate between
left-associative constructor application vs. right-associative binary
operation (e.g., (:)). When the query is meant to compute a value
of type r, then the result type withing generic folding is r -> r.
So the result of folding is a function to which we finally pass the
right unit.
With the -XDeriveDataTypeable option, GHC can generate instances of the
Data class automatically. For example, given the declaration
data T a b = C1 a b | C2 deriving (Typeable, Data)
GHC will generate an instance that is equivalent to
instance (Data a, Data b) => Data (T a b) where
gfoldl k z (C1 a b) = z C1 `k` a `k` b
gfoldl k z C2 = z C2
gunfold k z c = case constrIndex c of
1 -> k (k (z C1))
2 -> z C2
toConstr (C1 _ _) = con_C1
toConstr C2 = con_C2
dataTypeOf _ = ty_T
con_C1 = mkConstr ty_T "C1" [] Prefix
con_C2 = mkConstr ty_T "C2" [] Prefix
ty_T = mkDataType "Module.T" [con_C1, con_C2]
This is suitable for datatypes that are exported transparently.
Methods
Arguments
| :: (forall d b. Data d => c (d -> b) -> d -> c b) | defines how nonempty constructor applications are folded. It takes the folded tail of the constructor application and its head, i.e., an immediate subterm, and combines them in some way. |
| -> (forall g. g -> c g) | defines how the empty constructor application is folded, like the neutral / start element for list folding. |
| -> a | structure to be folded. |
| -> c a | result, with a type defined in terms of |
Left-associative fold operation for constructor applications.
The type of gfoldl is a headache, but operationally it is a simple
generalisation of a list fold.
The default definition for gfoldl is , which is
suitable for abstract datatypes with no substructures.
const id
gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c a
Unfolding constructor applications
Obtaining the constructor from a given datum. For proper terms, this is meant to be the top-level constructor. Primitive datatypes are here viewed as potentially infinite sets of values (i.e., constructors).
dataTypeOf :: a -> DataType
The outer type constructor of the type
dataCast1 :: Typeable1 t => (forall d. Data d => c (t d)) -> Maybe (c a)
Mediate types and unary type constructors.
In Data instances of the form T a, dataCast1 should be defined
as gcast1.
The default definition is , which is appropriate
for non-unary type constructors.
const Nothing
dataCast2 :: Typeable2 t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c a)
Mediate types and binary type constructors.
In Data instances of the form T a b, dataCast2 should be
defined as gcast2.
The default definition is , which is appropriate
for non-binary type constructors.
const Nothing
gmapT :: (forall b. Data b => b -> b) -> a -> a
A generic transformation that maps over the immediate subterms
The default definition instantiates the type constructor c in the
type of gfoldl to an identity datatype constructor, using the
isomorphism pair as injection and projection.
gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> a -> r
A generic query with a left-associative binary operator
gmapQr :: (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> a -> r
A generic query with a right-associative binary operator
gmapQ :: (forall d. Data d => d -> u) -> a -> [u]
A generic query that processes the immediate subterms and returns a list of results. The list is given in the same order as originally specified in the declaratoin of the data constructors.
gmapQi :: Int -> (forall d. Data d => d -> u) -> a -> u
A generic query that processes one child by index (zero-based)
gmapM :: Monad m => (forall d. Data d => d -> m d) -> a -> m a
A generic monadic transformation that maps over the immediate subterms
The default definition instantiates the type constructor c in
the type of gfoldl to the monad datatype constructor, defining
injection and projection using return and >>=.
gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> a -> m a
Transformation of at least one immediate subterm does not fail
gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> a -> m a
Transformation of one immediate subterm with success
Instances
class Monad m
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.
Instances
| Monad [] | |
| Monad IO | |
| Monad Maybe | |
| Monad Result | |
| Monad Parser | |
| Monad P | |
| Monad ReadPrec | |
| Monad ReadP | |
| Monad P | |
| Monad ParseResult | |
| Monad Identity | |
| Monad Vector | |
| Monad Id | |
| Monad Box | |
| Monad Fay | |
| Monad Printer | |
| Monad Compile | |
| Monad ((->) r) | |
| Monad (Either e) | |
| Monad (Parser t) | |
| ArrowApply a => Monad (ArrowMonad a) | |
| Monad (DocM s) | |
| Monad (Lex r) | |
| Monad m => Monad (ListT m) | |
| Monad m => Monad (MaybeT m) | |
| Monad m => Monad (IdentityT m) | |
| Monad (ContT r 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 (ParsecT s u m) | |
| (Monoid w, Monad m) => Monad (RWST r w s m) | |
| (Monoid w, Monad m) => Monad (RWST r w s m) |
class Eq a where
The Eq class defines equality (==) and inequality (/=).
All the basic datatypes exported by the Prelude are instances of Eq,
and Eq may be derived for any datatype whose constituents are also
instances of Eq.
Instances
| Eq Bool | |
| Eq Char | |
| Eq Double | |
| Eq Float | |
| Eq Int | |
| Eq Int8 | |
| Eq Int16 | |
| Eq Int32 | |
| Eq Int64 | |
| Eq Integer | |
| Eq Ordering | |
| Eq Word | |
| Eq Word8 | |
| Eq Word16 | |
| Eq Word32 | |
| Eq Word64 | |
| Eq () | |
| Eq ByteString | |
| Eq Number | |
| Eq Text | |
| Eq UTCTime | |
| Eq DotNetTime | |
| Eq Value | |
| Eq Handle | |
| Eq ByteString | |
| Eq More | |
| Eq Finalizers | |
| Eq Number | |
| Eq Version | |
| Eq Constr | Equality of constructors |
| Eq DataRep | |
| Eq ConstrRep | |
| Eq Fixity | |
| Eq AsyncException | |
| Eq ArrayException | |
| Eq ExitCode | |
| Eq IOErrorType | |
| Eq BufferMode | |
| Eq Newline | |
| Eq NewlineMode | |
| Eq All | |
| Eq Any | |
| Eq GeneralCategory | |
| Eq Lexeme | |
| Eq MaskingState | |
| Eq IOException | |
| Eq ArithException | |
| Eq TypeRep | |
| Eq TyCon | |
| Eq Text | |
| Eq Permissions | |
| Eq LexContext | |
| Eq ExtContext | |
| Eq PPLayout | |
| Eq Fixity | |
| Eq ModuleName | |
| Eq SpecialCon | |
| Eq QName | |
| Eq Name | |
| Eq IPName | |
| Eq QOp | |
| Eq Op | |
| Eq CName | |
| Eq Module | |
| Eq ExportSpec | |
| Eq ImportDecl | |
| Eq ImportSpec | |
| Eq Assoc | |
| Eq Decl | |
| Eq Annotation | |
| Eq DataOrNew | |
| Eq Binds | |
| Eq IPBind | |
| Eq Match | |
| Eq QualConDecl | |
| Eq ConDecl | |
| Eq GadtDecl | |
| Eq ClassDecl | |
| Eq InstDecl | |
| Eq BangType | |
| Eq Rhs | |
| Eq GuardedRhs | |
| Eq Type | |
| Eq TyVarBind | |
| Eq Kind | |
| Eq FunDep | |
| Eq Asst | |
| Eq Literal | |
| Eq Exp | |
| Eq XName | |
| Eq XAttr | |
| Eq Bracket | |
| Eq Splice | |
| Eq Safety | |
| Eq CallConv | |
| Eq ModulePragma | |
| Eq Activation | |
| Eq Rule | |
| Eq RuleVar | |
| Eq WarningText | |
| Eq Pat | |
| Eq PXAttr | |
| Eq RPatOp | |
| Eq RPat | |
| Eq PatField | |
| Eq Stmt | |
| Eq QualStmt | |
| Eq FieldUpdate | |
| Eq Alt | |
| Eq GuardedAlts | |
| Eq GuardedAlt | |
| Eq Extension | |
| Eq SrcLoc | |
| Eq SrcSpan | |
| Eq SrcSpanInfo | |
| Eq Boxed | |
| Eq Tool | |
| Eq InfixOp | |
| Eq AssignOp | |
| Eq UnaryAssignOp | |
| Eq PrefixOp | |
| Eq SourcePos | |
| Eq Message | |
| Eq Value | |
| Eq LocalTime | |
| Eq NominalDiffTime | |
| Eq Day | |
| Eq SerializeContext | |
| Eq JsLit | |
| Eq JsName | |
| Eq JsExp | |
| Eq JsStmt | |
| Eq a => Eq [a] | |
| Eq a => Eq (Ratio a) | |
| Eq (StablePtr a) | |
| Eq (Ptr a) | |
| Eq (FunPtr a) | |
| Eq a => Eq (Maybe a) | |
| Eq a => Eq (Result a) | |
| Eq (ForeignPtr a) | |
| Eq a => Eq (Dual a) | |
| Eq a => Eq (Sum a) | |
| Eq a => Eq (Product a) | |
| Eq a => Eq (First a) | |
| Eq a => Eq (Last a) | |
| Eq (IORef a) | |
| Eq (MVar a) | |
| Eq a => Eq (Set a) | |
| Eq l => Eq (PExp l) | |
| Eq l => Eq (PFieldUpdate l) | |
| Eq l => Eq (ParseXAttr l) | |
| Eq l => Eq (PContext l) | |
| Eq l => Eq (PType l) | |
| Eq l => Eq (PAsst l) | |
| Eq a => Eq (Loc a) | |
| Eq l => Eq (ModuleName l) | |
| Eq l => Eq (SpecialCon l) | |
| Eq l => Eq (QName l) | |
| Eq l => Eq (Name l) | |
| Eq l => Eq (IPName l) | |
| Eq l => Eq (QOp l) | |
| Eq l => Eq (Op l) | |
| Eq l => Eq (CName l) | |
| Eq l => Eq (Module l) | |
| Eq l => Eq (ModuleHead l) | |
| Eq l => Eq (ExportSpecList l) | |
| Eq l => Eq (ExportSpec l) | |
| Eq l => Eq (ImportDecl l) | |
| Eq l => Eq (ImportSpecList l) | |
| Eq l => Eq (ImportSpec l) | |
| Eq l => Eq (Assoc l) | |
| Eq l => Eq (Decl l) | |
| Eq l => Eq (Annotation l) | |
| Eq l => Eq (DataOrNew l) | |
| Eq l => Eq (DeclHead l) | |
| Eq l => Eq (InstHead l) | |
| Eq l => Eq (Deriving l) | |
| Eq l => Eq (Binds l) | |
| Eq l => Eq (IPBind l) | |
| Eq l => Eq (Match l) | |
| Eq l => Eq (QualConDecl l) | |
| Eq l => Eq (ConDecl l) | |
| Eq l => Eq (FieldDecl l) | |
| Eq l => Eq (GadtDecl l) | |
| Eq l => Eq (ClassDecl l) | |
| Eq l => Eq (InstDecl l) | |
| Eq l => Eq (BangType l) | |
| Eq l => Eq (Rhs l) | |
| Eq l => Eq (GuardedRhs l) | |
| Eq l => Eq (Type l) | |
| Eq l => Eq (TyVarBind l) | |
| Eq l => Eq (Kind l) | |
| Eq l => Eq (FunDep l) | |
| Eq l => Eq (Context l) | |
| Eq l => Eq (Asst l) | |
| Eq l => Eq (Literal l) | |
| Eq l => Eq (Exp l) | |
| Eq l => Eq (XName l) | |
| Eq l => Eq (XAttr l) | |
| Eq l => Eq (Bracket l) | |
| Eq l => Eq (Splice l) | |
| Eq l => Eq (Safety l) | |
| Eq l => Eq (CallConv l) | |
| Eq l => Eq (ModulePragma l) | |
| Eq l => Eq (Activation l) | |
| Eq l => Eq (Rule l) | |
| Eq l => Eq (RuleVar l) | |
| Eq l => Eq (WarningText l) | |
| Eq l => Eq (Pat l) | |
| Eq l => Eq (PXAttr l) | |
| Eq l => Eq (RPatOp l) | |
| Eq l => Eq (RPat l) | |
| Eq l => Eq (PatField l) | |
| Eq l => Eq (Stmt l) | |
| Eq l => Eq (QualStmt l) | |
| Eq l => Eq (FieldUpdate l) | |
| Eq l => Eq (Alt l) | |
| Eq l => Eq (GuardedAlts l) | |
| Eq l => Eq (GuardedAlt l) | |
| Eq a => Eq (JavaScript a) | |
| Eq a => Eq (Id a) | |
| Eq a => Eq (Prop a) | |
| Eq a => Eq (LValue a) | |
| Eq a => Eq (Expression a) | |
| Eq a => Eq (CaseClause a) | |
| Eq a => Eq (CatchClause a) | |
| Eq a => Eq (VarDecl a) | |
| Eq a => Eq (ForInit a) | |
| Eq a => Eq (ForInInit a) | |
| Eq a => Eq (Statement a) | |
| Eq a => Eq (Vector a) | |
| (Unbox a, Eq a) => Eq (Vector a) | |
| (Eq a, Eq b) => Eq (Either a b) | |
| (Eq a, Eq b) => Eq (a, b) | |
| (Eq k, Eq v) => Eq (HashMap k v) | |
| (Eq k, Eq a) => Eq (Map k a) | |
| (Ix i, Eq e) => Eq (Array i e) | |
| (Eq k, Eq v) => Eq (Leaf k v) | |
| Eq a => Eq (Stream Id a) | |
| (Eq a, Eq b, Eq c) => Eq (a, b, c) | |
| Eq (STArray s i e) | |
| (Eq a, Eq b, Eq c, Eq d) => Eq (a, b, c, d) | |
| (Eq a, Eq b, Eq c, Eq d, Eq e) => Eq (a, b, c, d, e) | |
| (Eq a, Eq b, Eq c, Eq d, Eq e, Eq f) => Eq (a, b, c, d, e, f) | |
| (Eq a, Eq b, Eq c, Eq d, Eq e, Eq f, Eq g) => Eq (a, b, c, d, e, f, g) | |
| (Eq a, Eq b, Eq c, Eq d, Eq e, Eq f, Eq g, Eq h) => Eq (a, b, c, d, e, f, g, h) | |
| (Eq a, Eq b, Eq c, Eq d, Eq e, Eq f, Eq g, Eq h, Eq i) => Eq (a, b, c, d, e, f, g, h, i) | |
| (Eq a, Eq b, Eq c, Eq d, Eq e, Eq f, Eq g, Eq h, Eq i, Eq j) => Eq (a, b, c, d, e, f, g, h, i, j) | |
| (Eq a, Eq b, Eq c, Eq d, Eq e, Eq f, Eq g, Eq h, Eq i, Eq j, Eq k) => Eq (a, b, c, d, e, f, g, h, i, j, k) | |
| (Eq a, Eq b, Eq c, Eq d, Eq e, Eq f, Eq g, Eq h, Eq i, Eq j, Eq k, Eq l) => Eq (a, b, c, d, e, f, g, h, i, j, k, l) | |
| (Eq a, Eq b, Eq c, Eq d, Eq e, Eq f, Eq g, Eq h, Eq i, Eq j, Eq k, Eq l, Eq m) => Eq (a, b, c, d, e, f, g, h, i, j, k, l, m) | |
| (Eq a, Eq b, Eq c, Eq d, Eq e, Eq f, Eq g, Eq h, Eq i, Eq j, Eq k, Eq l, Eq m, Eq n) => Eq (a, b, c, d, e, f, g, h, i, j, k, l, m, n) | |
| (Eq a, Eq b, Eq c, Eq d, Eq e, Eq f, Eq g, Eq h, Eq i, Eq j, Eq k, Eq l, Eq m, Eq n, Eq o) => Eq (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o) |
The read function reads input from a string, which must be
completely consumed by the input process.
(/) :: Fractional a => a -> a -> a
fractional division
enumFromThen :: Num t => t -> t -> [t]Source
enumFromThenTo :: (Ord t, Num t) => t -> t -> t -> [t]Source
enumFromTo :: (Ord t, Num t) => t -> t -> [t]Source
fromInteger :: a -> aSource
fromIntegral :: Int -> DoubleSource
fromRational :: a -> aSource
intercalate :: [a] -> [[a]] -> [a]Source
intersperse :: a -> [a] -> [a]Source
prependToAll :: a -> [a] -> [a]Source
properFraction :: Double -> (Int, Double)Source
seq :: a -> b -> b
Evaluates its first argument to head normal form, and then returns its second argument as the result.