HORIZON HASKELLDocslts/ghc-9.14.xd82dee82026-10-12Search names, modules, packages, or :: a typeCtrl K

GHC 9.14.1 · lts/ghc-9.14.x · d82dee8 · 2026-10-12

Modulecardano-api-11.7.0.0

Cardano.Api.Parser.Text

  • 17 types
  • 4 classes
  • 108 values
valueoptional :: Alternative f => f a -> f (Maybe a)
#

One or none.

It is useful for modelling any computation that is allowed to fail.

Examples

Using the Alternative instance of Control.Monad.Except, the following functions:

Example1 expression
import Control.Monad.Except
Example2 expressions
canFail = throwError "it failed" :: Except String Intfinal = return 42                :: Except String Int

Can be combined by allowing the first function to fail:

Example1 expression
runExcept $ canFail *> finalLeft "it failed"
Example1 expression
runExcept $ optional canFail *> finalRight 42
valuedigitToInt :: Char -> Int
#

Convert a single digit Char to the corresponding Int. This function fails unless its argument satisfies isHexDigit, but recognises both upper- and lower-case hexadecimal digits (that is, '0'..'9', 'a'..'f', 'A'..'F').

Examples

Characters '0' through '9' are converted properly to 0..9:

Example1 expression
map digitToInt ['0'..'9'][0,1,2,3,4,5,6,7,8,9]

Both upper- and lower-case 'A' through 'F' are converted as well, to 10..15.

Example2 expressions
map digitToInt ['a'..'f'][10,11,12,13,14,15]map digitToInt ['A'..'F'][10,11,12,13,14,15]

Anything else throws an exception:

Example2 expressions
digitToInt 'G'*** Exception: Char.digitToInt: not a digit 'G'digitToInt '♥'*** Exception: Char.digitToInt: not a digit '\9829'
value(<**>) :: Applicative f => f a -> f (a -> b) -> f b
#

A variant of <*> with the types of the arguments reversed. It differs from flip (<*>) in that the effects are resolved in the order the arguments are presented.

Examples
Example1 expression
(<**>) (print 1) (id <$ print 2)12
Example1 expression
flip (<*>) (print 1) (id <$ print 2)21
Example1 expression
ZipList [4, 5, 6] <**> ZipList [(+1), (*2), (/3)]ZipList {getZipList = [5.0,10.0,2.0]}
valueliftA :: Applicative f => (a -> b) -> f a -> f b
#

Lift a function to actions. Equivalent to Functor's fmap but implemented using only Applicative's methods: liftA f a = pure f <*> a

As such this function may be used to implement a Functor instance from an Applicative one.

Examples

Using the Applicative instance for Lists:

Example1 expression
liftA (+1) [1, 2][2,3]

Or the Applicative instance for Maybe

Example1 expression
liftA (+1) (Just 3)Just 4
valueliftA3 :: Applicative f => (a -> b -> c -> d) -> f a -> f b -> f c -> f d
#

Lift a ternary function to actions.

valueasum :: (Foldable t, Alternative f) => t (f a) -> f a
#

The sum of a collection of actions using (<|>), generalizing concat.

asum is just like msum, but generalised to Alternative.

Examples

Basic usage:

Example1 expression
asum [Just "Hello", Nothing, Just "World"]Just "Hello"
value($>) :: Functor f => f a -> b -> f b
#

Flipped version of <$.

Examples

Replace the contents of a Maybe Int with a constant String:

Example1 expression
Nothing $> "foo"Nothing
Example1 expression
Just 90210 $> "foo"Just "foo"

Replace the contents of an Either Int Int with a constant String, resulting in an Either Int String:

Example1 expression
Left 8675309 $> "foo"Left 8675309
Example1 expression
Right 8675309 $> "foo"Right "foo"

Replace each element of a list with a constant String:

Example1 expression
[1,2,3] $> "foo"["foo","foo","foo"]

Replace the second element of a pair with a constant String:

Example1 expression
(1,2) $> "foo"(1,"foo")
value(<$>) :: Functor f => (a -> b) -> f a -> f b
#

An infix synonym for fmap.

The name of this operator is an allusion to Prelude.$. Note the similarities between their types:

 ($)  ::              (a -> b) ->   a ->   b
(<$>) :: Functor f => (a -> b) -> f a -> f b

Whereas Prelude.$ is function application, <$> is function application lifted over a Functor.

Examples

Convert from a Maybe Int to a Maybe String using show:

Example1 expression
show <$> NothingNothing
Example1 expression
show <$> Just 3Just "3"

Convert from an Either Int Int to an Either Int String using show:

Example1 expression
show <$> Left 17Left 17
Example1 expression
show <$> Right 17Right "17"

Double each element of a list:

Example1 expression
(*2) <$> [1,2,3][2,4,6]

Apply even to the second element of a pair:

Example1 expression
even <$> (2,2)(2,True)
value(<&>) :: Functor f => f a -> (a -> b) -> f b
#

Flipped version of <$>.

(<&>) = flip fmap
Examples

Apply (+1) to a list, a Just and a Right:

Example1 expression
Just 2 <&> (+1)Just 3
Example1 expression
[1,2,3] <&> (+1)[2,3,4]
Example1 expression
Right 3 <&> (+1)Right 4
valueunzip :: Functor f => f (a, b) -> (f a, f b)
#

Generalization of Data.List.unzip.

Examples
Example1 expression
unzip (Just ("Hello", "World"))(Just "Hello",Just "World")
Example1 expression
unzip [("I", "love"), ("really", "haskell")](["I","really"],["love","haskell"])
valuevoid :: Functor f => f a -> f ()
#

void value discards or ignores the result of evaluation, such as the return value of an System.IO.IO action.

Examples

Replace the contents of a Maybe Int with unit:

Example1 expression
void NothingNothing
Example1 expression
void (Just 3)Just ()

Replace the contents of an Either Int Int with unit, resulting in an Either Int ():

Example1 expression
void (Left 8675309)Left 8675309
Example1 expression
void (Right 8675309)Right ()

Replace every element of a list with unit:

Example1 expression
void [1,2,3][(),(),()]

Replace the second element of a pair with unit:

Example1 expression
void (1,2)(1,())

Discard the result of an System.IO.IO action:

Example1 expression
mapM print [1,2]12[(),()]
Example1 expression
void $ mapM print [1,2]12
valuealphaNum :: Stream s m Char => ParsecT s u m Char
#

Parses a alphabetic or numeric Unicode characters according to isAlphaNum. Returns the parsed character.

Note that numeric digits outside the ASCII range (such as arabic-indic digits like e.g. "٤" or U+0664), as well as numeric characters which aren't digits, are parsed by this function but not by digit.

valuechar :: Stream s m Char => Char -> ParsecT s u m Char
#

char c parses a single character c. Returns the parsed character (i.e. c).

 semiColon  = char ';'
valuecrlf :: Stream s m Char => ParsecT s u m Char
#

Parses a carriage return character ('\r') followed by a newline character ('\n'). Returns a newline character.

valuehexDigit :: Stream s m Char => ParsecT s u m Char
#

Parses a hexadecimal digit (a digit or a letter between 'a' and 'f' or 'A' and 'F'). Returns the parsed character.

valueletter :: Stream s m Char => ParsecT s u m Char
#

Parses an alphabetic Unicode characters (lower-case, upper-case and title-case letters, plus letters of caseless scripts and modifiers letters according to isAlpha). Returns the parsed character.

valuenoneOf :: Stream s m Char => [Char] -> ParsecT s u m Char
#

As the dual of oneOf, noneOf cs succeeds if the current character not in the supplied list of characters cs. Returns the parsed character.

 consonant = noneOf "aeiou"
valueoneOf :: Stream s m Char => [Char] -> ParsecT s u m Char
#

oneOf cs succeeds if the current character is in the supplied list of characters cs. Returns the parsed character. See also satisfy.

  vowel  = oneOf "aeiou"
valuesatisfy :: Stream s m Char => (Char -> Bool) -> ParsecT s u m Char
#

The parser satisfy f succeeds for any character for which the supplied function f returns True. Returns the character that is actually parsed.

valueanyToken :: (Stream s m t, Show t) => ParsecT s u m t
#

The parser anyToken accepts any kind of token. It is for example used to implement eof. Returns the accepted token.

valuebetween
  1. :: Stream s m t
  2. => ParsecT s u m open
  3. -> ParsecT s u m close
  4. -> ParsecT s u m a
  5. -> ParsecT s u m a
#

between open close p parses open, followed by p and close. Returns the value returned by p.

 braces  = between (symbol "{") (symbol "}")
valuechainl
  1. :: Stream s m t
  2. => ParsecT s u m a
  3. -> ParsecT s u m (a -> a -> a)
  4. -> a
  5. -> ParsecT s u m a
#

chainl p op x parses zero or more occurrences of p, separated by op. Returns a value obtained by a left associative application of all functions returned by op to the values returned by p. If there are zero occurrences of p, the value x is returned.

valuechainl1
  1. :: Stream s m t
  2. => ParsecT s u m a
  3. -> ParsecT s u m (a -> a -> a)
  4. -> ParsecT s u m a
#

chainl1 p op parses one or more occurrences of p, separated by op Returns a value obtained by a left associative application of all functions returned by op to the values returned by p. This parser can for example be used to eliminate left recursion which typically occurs in expression grammars.

 expr    = term   `chainl1` addop
 term    = factor `chainl1` mulop
 factor  = parens expr <|> integer

 mulop   =   do{ symbol "*"; return (*)   }
         <|> do{ symbol "/"; return (div) }

 addop   =   do{ symbol "+"; return (+) }
         <|> do{ symbol "-"; return (-) }
valuechainr
  1. :: Stream s m t
  2. => ParsecT s u m a
  3. -> ParsecT s u m (a -> a -> a)
  4. -> a
  5. -> ParsecT s u m a
#

chainr p op x parses zero or more occurrences of p, separated by op Returns a value obtained by a right associative application of all functions returned by op to the values returned by p. If there are no occurrences of p, the value x is returned.

valuechainr1
  1. :: Stream s m t
  2. => ParsecT s u m a
  3. -> ParsecT s u m (a -> a -> a)
  4. -> ParsecT s u m a
#

chainr1 p op x parses one or more occurrences of |p|, separated by op Returns a value obtained by a right associative application of all functions returned by op to the values returned by p.

valuechoice :: Stream s m t => [ParsecT s u m a] -> ParsecT s u m a
#

choice ps tries to apply the parsers in the list ps in order, until one of them succeeds. Returns the value of the succeeding parser.

valuecount :: Stream s m t => Int -> ParsecT s u m a -> ParsecT s u m [a]
#

count n p parses n occurrences of p. If n is smaller or equal to zero, the parser equals to return []. Returns a list of n values returned by p.

valueendBy
  1. :: Stream s m t
  2. => ParsecT s u m a
  3. -> ParsecT s u m sep
  4. -> ParsecT s u m [a]
#

endBy p sep parses zero or more occurrences of p, separated and ended by sep. Returns a list of values returned by p.

  cStatements  = cStatement `endBy` semi
valueendBy1
  1. :: Stream s m t
  2. => ParsecT s u m a
  3. -> ParsecT s u m sep
  4. -> ParsecT s u m [a]
#

endBy1 p sep parses one or more occurrences of p, separated and ended by sep. Returns a list of values returned by p.

valueeof :: (Stream s m t, Show t) => ParsecT s u m ()
#

This parser only succeeds at the end of the input. This is not a primitive parser but it is defined using notFollowedBy.

 eof  = notFollowedBy anyToken <?> "end of input"
valuemanyTill
  1. :: Stream s m t
  2. => ParsecT s u m a
  3. -> ParsecT s u m end
  4. -> ParsecT s u m [a]
#

manyTill p end applies parser p zero or more times until parser end succeeds. Returns the list of values returned by p. This parser can be used to scan comments:

 simpleComment   = do{ string "<!--"
                     ; manyTill anyChar (try (string "-->"))
                     }

Note the overlapping parsers anyChar and string "-->", and therefore the use of the try combinator.

valuenotFollowedBy
  1. :: (Stream s m t, Show a)
  2. => ParsecT s u m a
  3. -> ParsecT s u m ()
#

notFollowedBy p only succeeds when parser p fails. This parser does not consume any input. This parser can be used to implement the 'longest match' rule. For example, when recognizing keywords (for example let), we want to make sure that a keyword is not followed by a legal identifier character, in which case the keyword is actually an identifier (for example lets). We can program this behaviour as follows:

 keywordLet  = try (do{ string "let"
                      ; notFollowedBy alphaNum
                      })

NOTE: Currently, notFollowedBy exhibits surprising behaviour when applied to a parser p that doesn't consume any input; specifically

See haskell/parsec#8 for more details.

valueoption :: Stream s m t => a -> ParsecT s u m a -> ParsecT s u m a
#

option x p tries to apply parser p. If p fails without consuming input, it returns the value x, otherwise the value returned by p.

 priority  = option 0 (do{ d <- digit
                         ; return (digitToInt d)
                         })
valueparserTrace :: (Show t, Stream s m t) => String -> ParsecT s u m ()
#

parserTrace label is an impure function, implemented with Debug.Trace that prints to the console the remaining parser state at the time it is invoked. It is intended to be used for debugging parsers by inspecting their intermediate states.

*> parseTest (oneOf "aeiou"  >> parserTrace "label") "atest"
label: "test"
...
valueparserTraced
  1. :: (Stream s m t, Show t)
  2. => String
  3. -> ParsecT s u m b
  4. -> ParsecT s u m b
#

parserTraced label p is an impure function, implemented with Debug.Trace that prints to the console the remaining parser state at the time it is invoked. It then continues to apply parser p, and if p fails will indicate that the label has been backtracked. It is intended to be used for debugging parsers by inspecting their intermediate states.

*>  parseTest (oneOf "aeiou"  >> parserTraced "label" (oneOf "nope")) "atest"
label: "test"
label backtracked
parse error at (line 1, column 2):
...
valuesepBy
  1. :: Stream s m t
  2. => ParsecT s u m a
  3. -> ParsecT s u m sep
  4. -> ParsecT s u m [a]
#

sepBy p sep parses zero or more occurrences of p, separated by sep. Returns a list of values returned by p.

 commaSep p  = p `sepBy` (symbol ",")
valuesepBy1
  1. :: Stream s m t
  2. => ParsecT s u m a
  3. -> ParsecT s u m sep
  4. -> ParsecT s u m [a]
#

sepBy1 p sep parses one or more occurrences of p, separated by sep. Returns a list of values returned by p.

valuesepEndBy
  1. :: Stream s m t
  2. => ParsecT s u m a
  3. -> ParsecT s u m sep
  4. -> ParsecT s u m [a]
#

sepEndBy p sep parses zero or more occurrences of p, separated and optionally ended by sep, ie. haskell style statements. Returns a list of values returned by p.

 haskellStatements  = haskellStatement `sepEndBy` semi
valuesepEndBy1
  1. :: Stream s m t
  2. => ParsecT s u m a
  3. -> ParsecT s u m sep
  4. -> ParsecT s u m [a]
#

sepEndBy1 p sep parses one or more occurrences of p, separated and optionally ended by sep. Returns a list of values returned by p.

valuebuildExpressionParser
  1. :: Stream s m t
  2. => OperatorTable s u m a
  3. -> ParsecT s u m a
  4. -> ParsecT s u m a
#

buildExpressionParser table term builds an expression parser for terms term with operators from table, taking the associativity and precedence specified in table into account. Prefix and postfix operators of the same precedence can only occur once (i.e. --2 is not allowed if - is prefix negate). Prefix and postfix operators of the same precedence associate to the left (i.e. if ++ is postfix increment, than -2++ equals -1, not -3).

The buildExpressionParser takes care of all the complexity involved in building expression parser. Here is an example of an expression parser that handles prefix signs, postfix increment and basic arithmetic.

 expr    = buildExpressionParser table term
         <?> "expression"

 term    =  parens expr
         <|> natural
         <?> "simple expression"

 table   = [ [prefix "-" negate, prefix "+" id ]
           , [postfix "++" (+1)]
           , [binary "*" (*) AssocLeft, binary "/" (div) AssocLeft ]
           , [binary "+" (+) AssocLeft, binary "-" (-)   AssocLeft ]
           ]

 binary  name fun assoc = Infix (do{ reservedOp name; return fun }) assoc
 prefix  name fun       = Prefix (do{ reservedOp name; return fun })
 postfix name fun       = Postfix (do{ reservedOp name; return fun })
value(<?>) :: ParsecT s u m a -> String -> ParsecT s u m a
#

The parser p <?> msg behaves as parser p, but whenever the parser p fails without consuming any input, it replaces expect error messages with the expect error message msg.

This is normally used at the end of a set alternatives where we want to return an error message in terms of a higher level construct rather than returning all possible characters. For example, if the expr parser from the try example would fail, the error message is: '...: expecting expression'. Without the (<?>) combinator, the message would be like '...: expecting "let" or letter', which is less friendly.

valuelookAhead :: Stream s m t => ParsecT s u m a -> ParsecT s u m a
#

lookAhead p parses p without consuming any input.

If p fails and consumes some input, so does lookAhead. Combine with try if this is undesirable.

valuemany1 :: ParsecT s u m a -> ParsecT s u m [a]
#

many1 p applies the parser p one or more times. Returns a list of the returned values of p.

 word  = many1 letter
valuemodifyState :: Monad m => (u -> u) -> ParsecT s u m ()
#

modifyState f applies function f to the user state. Suppose that we want to count identifiers in a source, we could use the user state as:

 expr  = do{ x <- identifier
           ; modifyState (+1)
           ; return (Id x)
           }
valueparse
  1. :: Stream s Identity t
  2. => Parsec s () a
  3. -> SourceName
  4. -> s
  5. -> Either ParseError a
#

parse p filePath input runs a parser p over Identity without user state. The filePath is only used in error messages and may be the empty string. Returns either a ParseError (Left) or a value of type a (Right).

 main    = case (parse numbers "" "11, 2, 43") of
            Left err  -> print err
            Right xs  -> print (sum xs)

 numbers = commaSep integer
valueparseTest :: (Stream s Identity t, Show a) => Parsec s () a -> s -> IO ()
#

The expression parseTest p input applies a parser p against input input and prints the result to stdout. Used for testing parsers.

valuerunParsecT
  1. :: Monad m
  2. => ParsecT s u m a
  3. -> State s u
  4. -> m (Consumed (m (Reply s u a)))
#

Low-level unpacking of the ParsecT type. To run your parser, please look to runPT, runP, runParserT, runParser and other such functions.

valuerunParserT
  1. :: Stream s m t
  2. => ParsecT s u m a
  3. -> u
  4. -> SourceName
  5. -> s
  6. -> m (Either ParseError a)
#

The most general way to run a parser. runParserT p state filePath input runs parser p on the input list of tokens input, obtained from source filePath with the initial user state st. The filePath is only used in error messages and may be the empty string. Returns a computation in the underlying monad m that return either a ParseError (Left) or a value of type a (Right).

valuesetInput :: Monad m => s -> ParsecT s u m ()
#

setInput input continues parsing with input. The getInput and setInput functions can for example be used to deal with #include files.

valuesetState :: Monad m => u -> ParsecT s u m ()
#

An alias for putState for backwards compatibility.

valueskipMany :: ParsecT s u m a -> ParsecT s u m ()
#

skipMany p applies the parser p zero or more times, skipping its result.

 spaces  = skipMany space
valuetoken
  1. :: Stream s Identity t
  2. => (t -> String)

    Token pretty-printing function.

  3. -> (t -> SourcePos)

    Computes the position of a token.

  4. -> (t -> Maybe a)

    Matching function for the token to parse.

  5. -> Parsec s u a
#

The parser token showTok posFromTok testTok accepts a token t with result x when the function testTok t returns Just x. The source position of the t should be returned by posFromTok t and the token can be shown using showTok t.

This combinator is expressed in terms of tokenPrim. It is used to accept user defined token streams. For example, suppose that we have a stream of basic tokens tupled with source positions. We can then define a parser that accepts single tokens as:

 mytoken x
   = token showTok posFromTok testTok
   where
     showTok (pos,t)     = show t
     posFromTok (pos,t)  = pos
     testTok (pos,t)     = if x == t then Just t else Nothing
valuetokenPrim
  1. :: Stream s m t
  2. => (t -> String)

    Token pretty-printing function.

  3. -> (SourcePos -> t -> s -> SourcePos)

    Next position calculating function.

  4. -> (t -> Maybe a)

    Matching function for the token to parse.

  5. -> ParsecT s u m a
#

The parser tokenPrim showTok nextPos testTok accepts a token t with result x when the function testTok t returns Just x. The token can be shown using showTok t. The position of the next token should be returned when nextPos is called with the current source position pos, the current token t and the rest of the tokens toks, nextPos pos t toks.

This is the most primitive combinator for accepting tokens. For example, the char parser could be implemented as:

 char c
   = tokenPrim showChar nextPos testChar
   where
     showChar x        = "'" ++ x ++ "'"
     testChar x        = if x == c then Just x else Nothing
     nextPos pos x xs  = updatePosChar pos x
valuetry :: ParsecT s u m a -> ParsecT s u m a
#

The parser try p behaves like parser p, except that it pretends that it hasn't consumed any input when an error occurs.

This combinator is used whenever arbitrary look ahead is needed. Since it pretends that it hasn't consumed any input when p fails, the (<|>) combinator will try its second alternative even when the first parser failed while consuming input.

The try combinator can for example be used to distinguish identifiers and reserved words. Both reserved words and identifiers are a sequence of letters. Whenever we expect a certain reserved word where we can also expect an identifier we have to use the try combinator. Suppose we write:

 expr        = letExpr <|> identifier <?> "expression"

 letExpr     = do{ string "let"; ... }
 identifier  = many1 letter

If the user writes "lexical", the parser fails with: unexpected 'x', expecting 't' in "let". Indeed, since the (<|>) combinator only tries alternatives when the first alternative hasn't consumed input, the identifier parser is never tried (because the prefix "le" of the string "let" parser is already consumed). The right behaviour can be obtained by adding the try combinator:

 expr        = letExpr <|> identifier <?> "expression"

 letExpr     = do{ try (string "let"); ... }
 identifier  = many1 letter
valueunexpected :: Stream s m t => String -> ParsecT s u m a
#

The parser unexpected msg always fails with an unexpected error message msg without consuming any input.

The parsers fail, (<?>) and unexpected are the three parsers used to generate error messages. Of these, only (<?>) is commonly used. For an example of the use of unexpected, see the definition of notFollowedBy.

newtypenewtype WrappedArrow (a :: Type -> Type -> Type) b c
#

Constructors

Instances21Generic1, Invariant2, Functor, Applicative, Alternative, Alt, …
newtypenewtype WrappedMonad (m :: Type -> Type) a
#

Constructors

Instances26Generic1, Monad, Functor, Applicative, Alternative, Distributive, …
classclass Applicative f => Alternative (f :: Type -> Type) where
#

A monoid on applicative functors.

If defined, some and many should be the least solutions of the equations:

Examples
Example1 expression
Nothing <|> Just 42Just 42
Example1 expression
[1, 2] <|> [3, 4][1,2,3,4]
Example1 expression
empty <|> print (2^15)32768

Methods

  • empty :: f a

    The identity of <|>

    empty <|> a     == a
    a     <|> empty == a
  • (<|>) :: f a -> f a -> f ainfixl 3

    An associative binary operation

  • some :: f a -> f [a]

    One or more.

    Examples
    Example1 expression
    some (putStr "la")lalalalalalalalala... * goes on forever *
    Example1 expression
    some Nothingnothing
    Example1 expression
    take 5 <$> some (Just 1)* hangs forever *

    Note that this function can be used with Parsers based on Applicatives. In that case some parser will attempt to parse parser one or more times until it fails.

  • many :: f a -> f [a]

    Zero or more.

    Examples
    Example1 expression
    many (putStr "la")lalalalalalalalala... * goes on forever *
    Example1 expression
    many NothingJust []
    Example1 expression
    take 5 <$> many (Just 1)* hangs forever *

    Note that this function can be used with Parsers based on Applicatives. In that case many parser will attempt to parse parser zero or more times until it fails.

Instances158:=>, Lifting2, Lifting, Class, Alternative, …
classclass Functor f => Applicative (f :: Type -> Type) where
#

A functor with application, providing operations to

  • embed pure expressions (pure), and

  • sequence computations and combine their results (<*> and liftA2).

A minimal complete definition must include implementations of pure and of either <*> or liftA2. If it defines both, then they must behave the same as their default definitions:

(<*>) = liftA2 id
liftA2 f x y = f Prelude.<$> x <*> y

Further, any definition must satisfy the following:

Identity
pure id <*> v = v
Composition
pure (.) <*> u <*> v <*> w = u <*> (v <*> w)
Homomorphism
pure f <*> pure x = pure (f x)
Interchange
u <*> pure y = pure ($ y) <*> u

The other methods have the following default definitions, which may be overridden with equivalent specialized implementations:

As a consequence of these laws, the Functor instance for f will satisfy

It may be useful to note that supposing

forall x y. p (q x y) = f x . g y

it follows from the above that

liftA2 p (liftA2 q u v) = liftA2 f u . liftA2 g v

If f is also a Monad, it should satisfy

(which implies that pure and <*> satisfy the applicative functor laws).

Methods

  • pure :: a -> f a

    Lift a value into the Structure.

    Examples
    Example1 expression
    pure 1 :: Maybe IntJust 1
    Example1 expression
    pure 'z' :: [Char]"z"
    Example1 expression
    pure (pure ":D") :: Maybe [String]Just [":D"]
  • (<*>) :: f (a -> b) -> f a -> f binfixl 4

    Sequential application.

    A few functors support an implementation of <*> that is more efficient than the default one.

    Example

    Used in combination with (Data.Functor.<$>), (<*>) can be used to build a record.

    Example1 expression
    data MyState = MyState {arg1 :: Foo, arg2 :: Bar, arg3 :: Baz}
    Example3 expressions
    produceFoo :: Applicative f => f FooproduceBar :: Applicative f => f BarproduceBaz :: Applicative f => f Baz
    Example2 expressions
    mkState :: Applicative f => f MyStatemkState = MyState <$> produceFoo <*> produceBar <*> produceBaz
  • liftA2 :: (a -> b -> c) -> f a -> f b -> f c

    Lift a binary function to actions.

    Some functors support an implementation of liftA2 that is more efficient than the default one. In particular, if fmap is an expensive operation, it is likely better to use liftA2 than to fmap over the structure and then use <*>.

    This became a typeclass method in 4.10.0.0. Prior to that, it was a function defined in terms of <*> and fmap.

    Example
    Example1 expression
    liftA2 (,) (Just 3) (Just 5)Just (3,5)
    Example1 expression
    liftA2 (+) [1, 2, 3] [4, 5, 6][5,6,7,6,7,8,7,8,9]
  • (*>) :: f a -> f b -> f binfixl 4

    Sequence actions, discarding the value of the first argument.

    Examples

    If used in conjunction with the Applicative instance for Maybe, you can chain Maybe computations, with a possible "early return" in case of Nothing.

    Example1 expression
    Just 2 *> Just 3Just 3
    Example1 expression
    Nothing *> Just 3Nothing

    Of course a more interesting use case would be to have effectful computations instead of just returning pure values.

    Example4 expressions
    import Data.Charimport GHC.Internal.Text.ParserCombinators.ReadPlet p = string "my name is " *> munch1 isAlpha <* eofreadP_to_S p "my name is Simon"[("Simon","")]
  • (<*) :: f a -> f b -> f ainfixl 4

    Sequence actions, discarding the value of the second argument.

Instances387:=>, Class, Lifting2, Lifting, Applicative, …
classclass Functor (f :: Type -> Type) where
#

A type f is a Functor if it provides a function fmap which, given any types a and b lets you apply any function from (a -> b) to turn an f a into an f b, preserving the structure of f. Furthermore f needs to adhere to the following:

Identity

fmap id == id

Composition

fmap (f . g) == fmap f . fmap g

Note, that the second law follows from the free theorem of the type fmap and the first law, so you need only check that the former condition holds. See these articles by School of Haskell or David Luposchainsky for an explanation.

Methods

  • fmap :: (a -> b) -> f a -> f b

    fmap is used to apply a function of type (a -> b) to a value of type f a, where f is a functor, to produce a value of type f b. Note that for any type constructor with more than one parameter (e.g., Either), only the last type parameter can be modified with fmap (e.g., b in Either a b).

    Some type constructors with two parameters or more have a Data.Bifunctor instance that allows both the last and the penultimate parameters to be mapped over.

    Examples

    Convert from a Maybe Int to a Maybe String using show:

    Example2 expressions
    fmap show NothingNothingfmap show (Just 3)Just "3"

    Convert from an Either Int Int to an Either Int String using show:

    Example2 expressions
    fmap show (Left 17)Left 17fmap show (Right 17)Right "17"

    Double each element of a list:

    Example1 expression
    fmap (*2) [1,2,3][2,4,6]

    Apply even to the second element of a pair:

    Example1 expression
    fmap even (2,2)(2,True)

    It may seem surprising that the function is only applied to the last element of the tuple compared to the list example above which applies it to every element in the list. To understand, remember that tuples are type constructors with multiple type parameters: a tuple of 3 elements (a,b,c) can also be written (,,) a b c and its Functor instance is defined for Functor ((,,) a b) (i.e., only the third parameter is free to be mapped over with fmap).

    It explains why fmap can be used with tuples containing values of different types as in the following example:

    Example1 expression
    fmap even ("hello", 1.0, 4)("hello",1.0,True)
  • (<$) :: a -> f b -> f ainfixl 4

    Replace all locations in the input with the same value. The default definition is fmap . const, but this may be overridden with a more efficient version.

    Examples

    Perform a computation with Maybe and replace the result with a constant value if it is Just:

    Example2 expressions
    'a' <$ Just 2Just 'a''a' <$ NothingNothing
Instances707:=>, Class, Lifting2, Lifting, Functor, …
  • Functor OnlyDefined in Only-0.1 · Data.Tuple.Only
  • Functor GenDefined in QuickCheck-2.18.0.0 · Test.QuickCheck.Gen
  • Functor BlindDefined in QuickCheck-2.18.0.0 · Test.QuickCheck.Modifiers
  • Functor FixedDefined in QuickCheck-2.18.0.0 · Test.QuickCheck.Modifiers
  • Functor LargeDefined in QuickCheck-2.18.0.0 · Test.QuickCheck.Modifiers
  • Functor NegativeDefined in QuickCheck-2.18.0.0 · Test.QuickCheck.Modifiers
  • Functor NoShrinkDefined in QuickCheck-2.18.0.0 · Test.QuickCheck.Modifiers
  • Functor NonEmptyListDefined in QuickCheck-2.18.0.0 · Test.QuickCheck.Modifiers
  • Functor NonNegativeDefined in QuickCheck-2.18.0.0 · Test.QuickCheck.Modifiers
  • Functor NonPositiveDefined in QuickCheck-2.18.0.0 · Test.QuickCheck.Modifiers
  • Functor NonZeroDefined in QuickCheck-2.18.0.0 · Test.QuickCheck.Modifiers
  • Functor OrderedListDefined in QuickCheck-2.18.0.0 · Test.QuickCheck.Modifiers
  • Functor PositiveDefined in QuickCheck-2.18.0.0 · Test.QuickCheck.Modifiers
  • Functor Shrink2Defined in QuickCheck-2.18.0.0 · Test.QuickCheck.Modifiers
  • Functor SmallDefined in QuickCheck-2.18.0.0 · Test.QuickCheck.Modifiers
  • Functor SmartDefined in QuickCheck-2.18.0.0 · Test.QuickCheck.Modifiers
  • Functor SortedListDefined in QuickCheck-2.18.0.0 · Test.QuickCheck.Modifiers
  • Functor RoseDefined in QuickCheck-2.18.0.0 · Test.QuickCheck.Property
  • Functor KeyMapDefined in aeson-2.2.5.1 · Data.Aeson.KeyMap
  • Functor FromJSONKeyFunctionDefined in aeson-2.2.5.1 · Data.Aeson.Types.FromJSON

    Only law abiding up to interpretation

  • Functor IResultDefined in aeson-2.2.5.1 · Data.Aeson.Types.Internal
  • Functor ParserDefined in aeson-2.2.5.1 · Data.Aeson.Types.Internal
  • Functor ResultDefined in aeson-2.2.5.1 · Data.Aeson.Types.Internal
  • Functor GraphDefined in algebraic-graphs-0.8 · Algebra.Graph

    fmap is a good consumer and producer.

  • Functor ListDefined in algebraic-graphs-0.8 · Algebra.Graph.Internal
  • Functor ExtendedDefined in algebraic-graphs-0.8 · Algebra.Graph.Label
  • Functor LabelDefined in algebraic-graphs-0.8 · Algebra.Graph.Label
  • Functor MinimumDefined in algebraic-graphs-0.8 · Algebra.Graph.Label
  • Functor NonNegativeDefined in algebraic-graphs-0.8 · Algebra.Graph.Label
  • Functor GraphDefined in algebraic-graphs-0.8 · Algebra.Graph.NonEmpty
  • Functor GraphDefined in algebraic-graphs-0.8 · Algebra.Graph.Undirected
  • Functor AsyncDefined in async-2.2.6 · Control.Concurrent.Async.Internal
  • Functor ConcurrentlyDefined in async-2.2.6 · Control.Concurrent.Async.Internal
  • Functor ResultDefined in attoparsec-0.14.4 · Data.Attoparsec.ByteString.Lazy
  • Functor ResultDefined in attoparsec-0.14.4 · Data.Attoparsec.Text.Lazy
  • Functor ComplexDefined in base-4.22.0.0 · Data.Complex
  • Functor FirstDefined in base-4.22.0.0 · Data.Semigroup
  • Functor LastDefined in base-4.22.0.0 · Data.Semigroup
  • Functor MaxDefined in base-4.22.0.0 · Data.Semigroup
  • Functor MinDefined in base-4.22.0.0 · Data.Semigroup
  • Functor ArgDescrDefined in base-4.22.0.0 · System.Console.GetOpt
  • Functor ArgOrderDefined in base-4.22.0.0 · System.Console.GetOpt
  • Functor OptDescrDefined in base-4.22.0.0 · System.Console.GetOpt
  • Functor ArrayDefined in basement-0.0.16 · Basement.BoxedArray
  • Functor DecoderDefined in binary-0.8.9.3 · Data.Binary.Get.Internal
  • Functor GetDefined in binary-0.8.9.3 · Data.Binary.Get.Internal
  • Functor PutMDefined in binary-0.8.9.3 · Data.Binary.Put
  • Functor MarkupMDefined in blaze-markup-0.8.3.0 · Text.Blaze.Internal
  • Functor PutDefined in bytestring-0.12.2.0 · Data.ByteString.Builder.Internal
  • Functor TrieDefined in bytestring-trie-0.2.7.7 · Data.Trie.Internal
  • Functor AbstractEncodingDefined in cardano-addresses-4.0.2 · Codec.Binary.Encoding
  • Functor FileErrorDefined in cardano-api-11.7.0.0 · Cardano.Api.Error
  • Functor CaseDefined in cardano-binary-1.9.1.0 · Cardano.Binary.ToCBOR
  • Functor SizeFDefined in cardano-binary-1.9.1.0 · Cardano.Binary.ToCBOR
  • Functor MonadRandomFromSeedDefined in cardano-crypto-class-2.5.1.0 · Cardano.Crypto.Seed
  • Functor SecureRandomDefined in cardano-crypto-wrapper-1.7.0.0 · Cardano.Crypto.Random
  • Functor AnnotatorDefined in cardano-ledger-binary-1.9.1.0 · Cardano.Ledger.Binary.Decoding.Annotated
  • Functor ABlockDefined in cardano-ledger-byron-1.3.0.0 · Cardano.Chain.Block.Block
  • Functor ABlockOrBoundaryDefined in cardano-ledger-byron-1.3.0.0 · Cardano.Chain.Block.Block
  • Functor ABlockOrBoundaryHdrDefined in cardano-ledger-byron-1.3.0.0 · Cardano.Chain.Block.Block
  • Functor ABoundaryBlockDefined in cardano-ledger-byron-1.3.0.0 · Cardano.Chain.Block.Block
  • Functor ABoundaryBodyDefined in cardano-ledger-byron-1.3.0.0 · Cardano.Chain.Block.Block
  • Functor ABodyDefined in cardano-ledger-byron-1.3.0.0 · Cardano.Chain.Block.Body
  • Functor ABlockSignatureDefined in cardano-ledger-byron-1.3.0.0 · Cardano.Chain.Block.Header
  • Functor ABoundaryHeaderDefined in cardano-ledger-byron-1.3.0.0 · Cardano.Chain.Block.Header
  • Functor AHeaderDefined in cardano-ledger-byron-1.3.0.0 · Cardano.Chain.Block.Header
  • Functor ACertificateDefined in cardano-ledger-byron-1.3.0.0 · Cardano.Chain.Delegation.Certificate
  • Functor APayloadDefined in cardano-ledger-byron-1.3.0.0 · Cardano.Chain.Delegation.Payload
  • Functor AMempoolPayloadDefined in cardano-ledger-byron-1.3.0.0 · Cardano.Chain.MempoolPayload
  • Functor ATxAuxDefined in cardano-ledger-byron-1.3.0.0 · Cardano.Chain.UTxO.TxAux
  • Functor ATxPayloadDefined in cardano-ledger-byron-1.3.0.0 · Cardano.Chain.UTxO.TxPayload
  • Functor APayloadDefined in cardano-ledger-byron-1.3.0.0 · Cardano.Chain.Update.Payload
  • Functor AProposalDefined in cardano-ledger-byron-1.3.0.0 · Cardano.Chain.Update.Proposal
  • Functor AVoteDefined in cardano-ledger-byron-1.3.0.0 · Cardano.Chain.Update.Vote
  • Functor ExUnits'Defined in cardano-ledger-core-1.21.0.0 · Cardano.Ledger.Plutus.ExUnits
  • Functor WithOriginDefined in cardano-slotting-0.2.2.0 · Cardano.Slotting.Slot
  • Functor StrictMaybeDefined in cardano-strict-containers-0.1.6.0 · Data.Maybe.Strict
  • Functor StrictSeqDefined in cardano-strict-containers-0.1.6.0 · Data.Sequence.Strict
  • Functor IdentifierDefined in casing-0.1.4.1 · Text.Casing
  • Functor ParserDefined in cassava-0.5.4.1 · Data.Csv.Conversion
  • Functor HeaderParserDefined in cassava-0.5.4.1 · Data.Csv.Incremental
  • Functor ParserDefined in cassava-0.5.4.1 · Data.Csv.Incremental
  • Functor RecordsDefined in cassava-0.5.4.1 · Data.Csv.Streaming
  • Functor PPDefined in cborg-0.2.10.0 · Codec.CBOR.Pretty
  • Functor GetDefined in cereal-0.5.8.3 · Data.Serialize.Get
  • Functor ResultDefined in cereal-0.5.8.3 · Data.Serialize.Get
  • Functor PutMDefined in cereal-0.5.8.3 · Data.Serialize.Put
  • Functor RGBDefined in colour-2.3.7 · Data.Colour.RGB
  • Functor FlushDefined in conduit-1.3.6.1 · Data.Conduit.Internal.Conduit
  • Functor SCCDefined in containers-0.8 · Data.Graph
  • Functor IntMapDefined in containers-0.8 · Data.IntMap.Internal
  • Functor DigitDefined in containers-0.8 · Data.Sequence.Internal
  • Functor ElemDefined in containers-0.8 · Data.Sequence.Internal
  • Functor FingerTreeDefined in containers-0.8 · Data.Sequence.Internal
  • Functor NodeDefined in containers-0.8 · Data.Sequence.Internal
  • Functor SeqDefined in containers-0.8 · Data.Sequence.Internal
  • Functor ViewLDefined in containers-0.8 · Data.Sequence.Internal
  • Functor ViewRDefined in containers-0.8 · Data.Sequence.Internal
  • Functor PostOrderDefined in containers-0.8 · Data.Tree
  • Functor TreeDefined in containers-0.8 · Data.Tree
  • Functor CryptoFailableDefined in crypton-1.0.6 · Crypto.Error.Types
  • Functor DequeDefined in deque-0.4.4.4 · Deque.Lazy.Defs
  • Functor DequeDefined in deque-0.4.4.4 · Deque.Strict.Defs
  • Functor DNonEmptyDefined in dlist-1.0 · Data.DList.DNonEmpty.Internal
  • Functor DListDefined in dlist-1.0 · Data.DList.Internal
  • Functor GenDefined in foundation-0.0.30 · Foundation.Check.Gen
  • Functor CheckMainDefined in foundation-0.0.30 · Foundation.Check.Main
  • Functor CheckDefined in foundation-0.0.30 · Foundation.Check.Types
  • Functor DListDefined in foundation-0.0.30 · Foundation.List.DList
  • Functor PartialDefined in foundation-0.0.30 · Foundation.Partial
  • Functor TimingPlanDefined in foundation-0.0.30 · Foundation.Timing.Main
  • Functor PprMDefined in ghc-boot-th-9.14.1 · GHC.Boot.TH.PprLib
  • Functor NonEmptyDefined in ghc-internal-9.1401.0 · GHC.Internal.Data.NonEmpty · orphan
  • Functor STMDefined in ghc-internal-9.1401.0 · GHC.Internal.Conc.Sync
  • Functor HandlerDefined in ghc-internal-9.1401.0 · GHC.Internal.Control.Exception
  • Functor IdentityDefined in ghc-internal-9.1401.0 · GHC.Internal.Data.Functor.Identity
  • Functor FirstDefined in ghc-internal-9.1401.0 · GHC.Internal.Data.Monoid
  • Functor LastDefined in ghc-internal-9.1401.0 · GHC.Internal.Data.Monoid
  • Functor DownDefined in ghc-internal-9.1401.0 · GHC.Internal.Data.Ord
  • Functor DualDefined in ghc-internal-9.1401.0 · GHC.Internal.Data.Semigroup.Internal
  • Functor ProductDefined in ghc-internal-9.1401.0 · GHC.Internal.Data.Semigroup.Internal
  • Functor SumDefined in ghc-internal-9.1401.0 · GHC.Internal.Data.Semigroup.Internal
  • Functor ZipListDefined in ghc-internal-9.1401.0 · GHC.Internal.Functor.ZipList
  • Functor NoIODefined in ghc-internal-9.1401.0 · GHC.Internal.GHCi
  • Functor Par1Defined in ghc-internal-9.1401.0 · GHC.Internal.Generics
  • Functor GenClosureDefined in ghc-internal-9.1401.0 · GHC.Internal.Heap.Closures
  • Functor GenStackFieldDefined in ghc-internal-9.1401.0 · GHC.Internal.Heap.Closures
  • Functor GenStackFrameDefined in ghc-internal-9.1401.0 · GHC.Internal.Heap.Closures
  • Functor GenStgStackClosureDefined in ghc-internal-9.1401.0 · GHC.Internal.Heap.Closures
  • Functor MaybeDefined in ghc-internal-9.1401.0 · GHC.Internal.Base
  • Functor QDefined in ghc-internal-9.1401.0 · GHC.Internal.TH.Syntax
  • Functor TyVarBndrDefined in ghc-internal-9.1401.0 · GHC.Internal.TH.Syntax
  • Functor PDefined in ghc-internal-9.1401.0 · GHC.Internal.Text.ParserCombinators.ReadP
  • Functor ReadPDefined in ghc-internal-9.1401.0 · GHC.Internal.Text.ParserCombinators.ReadP
  • Functor ReadPrecDefined in ghc-internal-9.1401.0 · GHC.Internal.Text.ParserCombinators.ReadPrec
  • Functor SoloDefined in ghc-internal-9.1401.0 · GHC.Internal.Base
  • Functor IODefined in ghc-internal-9.1401.0 · GHC.Internal.Base
  • Functor PosDefined in hedgehog-1.7 · Hedgehog.Internal.Discovery
  • Functor CoverageDefined in hedgehog-1.7 · Hedgehog.Internal.Property
  • Functor LabelDefined in hedgehog-1.7 · Hedgehog.Internal.Property
  • Functor RangeDefined in hedgehog-1.7 · Hedgehog.Internal.Range
  • Functor DeclarationDefined in hedgehog-1.7 · Hedgehog.Internal.Report
  • Functor LineDefined in hedgehog-1.7 · Hedgehog.Internal.Report
  • Functor ReportDefined in hedgehog-1.7 · Hedgehog.Internal.Report
  • Functor ConcreteDefined in hedgehog-1.7 · Hedgehog.Internal.State
  • Functor LocalTimeDefined in hourglass-0.2.12 · Data.Hourglass.Local
  • Functor LenientDataDefined in http-api-data-0.7 · Web.Internal.HttpApiData
  • Functor ExitCaseDefined in io-classes-1.8.0.1 · Control.Monad.Class.MonadThrow
  • Functor LabelledDefined in io-sim-1.8.0.1 · Control.Monad.IOSim.CommonTypes
  • Functor SimResultDefined in io-sim-1.8.0.1 · Control.Monad.IOSim.Types
  • Functor ObjectDefined in json-stream-0.4.6.1 · Data.JsonStream.Parser
  • Functor ParseResultDefined in json-stream-0.4.6.1 · Data.JsonStream.Parser
  • Functor ParserDefined in json-stream-0.4.6.1 · Data.JsonStream.Parser
  • Functor ReadResultDefined in kes-agent-1.3.0.0 · Cardano.KESAgent.Serialization.RawUtil
  • Functor DequeDefined in lens-5.3.6 · Control.Lens.Internal.Deque
  • Functor RootDefined in math-functions-0.3.4.4 · Numeric.RootFinding
  • Functor SequenceDefined in math-functions-0.3.4.4 · Numeric.Series
  • Functor ErrorFancyDefined in megaparsec-9.8.3 · Text.Megaparsec.Error
  • Functor ErrorItemDefined in megaparsec-9.8.3 · Text.Megaparsec.Error
  • Functor PackerDefined in memory-0.18.0 · Data.ByteArray.Pack.Internal
  • Functor MonoidalIntMapDefined in monoidal-containers-0.6.8.0 · Data.IntMap.Monoidal
  • Functor MonoidalIntMapDefined in monoidal-containers-0.6.8.0 · Data.IntMap.Monoidal.Strict
  • Functor NEIntMapDefined in nonempty-containers-0.4.0.0 · Data.IntMap.NonEmpty.Lazy.Internal
  • Functor NESeqDefined in nonempty-containers-0.4.0.0 · Data.Sequence.NonEmpty.Internal
  • Functor NonEmptyVectorDefined in nonempty-vector-0.2.4 · Data.Vector.NonEmpty.Internal
  • Functor ChunkDefined in optparse-applicative-0.19.0.0 · Options.Applicative.Help.Chunk
  • Functor ComplResultDefined in optparse-applicative-0.19.0.0 · Options.Applicative.Internal
  • Functor CompletionDefined in optparse-applicative-0.19.0.0 · Options.Applicative.Internal
  • Functor PDefined in optparse-applicative-0.19.0.0 · Options.Applicative.Internal
  • Functor CReaderDefined in optparse-applicative-0.19.0.0 · Options.Applicative.Types
  • Functor OptReaderDefined in optparse-applicative-0.19.0.0 · Options.Applicative.Types
  • Functor OptionDefined in optparse-applicative-0.19.0.0 · Options.Applicative.Types
  • Functor ParserDefined in optparse-applicative-0.19.0.0 · Options.Applicative.Types
  • Functor ParserFailureDefined in optparse-applicative-0.19.0.0 · Options.Applicative.Types
  • Functor ParserInfoDefined in optparse-applicative-0.19.0.0 · Options.Applicative.Types
  • Functor ParserMDefined in optparse-applicative-0.19.0.0 · Options.Applicative.Types
  • Functor ParserResultDefined in optparse-applicative-0.19.0.0 · Options.Applicative.Types
  • Functor ReadMDefined in optparse-applicative-0.19.0.0 · Options.Applicative.Types
  • Functor TraceBlockchainTimeEventDefined in ouroboros-consensus-4.2.1.0 · Ouroboros.Consensus.BlockchainTime.WallClock.Util
  • Functor PerasEnabledDefined in ouroboros-consensus-4.2.1.0 · Ouroboros.Consensus.HardFork.History.EraParams
  • Functor QryDefined in ouroboros-consensus-4.2.1.0 · Ouroboros.Consensus.HardFork.History.Qry
  • Functor DeltaDefined in ouroboros-consensus-4.2.1.0 · Ouroboros.Consensus.Ledger.Tables.Diff
  • Functor LoEDefined in ouroboros-consensus-4.2.1.0 · Ouroboros.Consensus.Storage.ChainDB.API
  • Functor IteratorResultDefined in ouroboros-consensus-4.2.1.0 · Ouroboros.Consensus.Storage.ImmutableDB.API
  • Functor WithBlockSizeDefined in ouroboros-consensus-4.2.1.0 · Ouroboros.Consensus.Storage.ImmutableDB.Impl.Types
  • Functor TwoDefined in ouroboros-consensus-4.2.1.0 · Ouroboros.Consensus.Storage.ImmutableDB.Impl.Util
  • Functor EvalDefined in parallel-3.3.0.0 · Control.Parallel.Strategies
  • Functor ConsumedDefined in parsec-3.1.18.0 · Text.Parsec.Prim
  • Functor SpineDefined in plutus-core-1.70.0.0 · PlutusCore.Builtin.KnownType
  • Functor BuiltinResultDefined in plutus-core-1.70.0.0 · PlutusCore.Builtin.Result
  • Functor BinderDefined in plutus-core-1.70.0.0 · PlutusCore.Core.Type
  • Functor KindDefined in plutus-core-1.70.0.0 · PlutusCore.Core.Type
  • Functor NormalizedDefined in plutus-core-1.70.0.0 · PlutusCore.Core.Type
  • Functor ExpectedShapeOrDefined in plutus-core-1.70.0.0 · PlutusCore.Error
  • Functor UniqueErrorDefined in plutus-core-1.70.0.0 · PlutusCore.Error
  • Functor MachineErrorDefined in plutus-core-1.70.0.0 · PlutusCore.Evaluation.Machine.Exception
  • Functor EvaluationResultDefined in plutus-core-1.70.0.0 · PlutusCore.Evaluation.Result
  • Functor NamedDefined in plutus-core-1.70.0.0 · PlutusCore.Name.Unique
  • Functor DecodeUniMDefined in plutus-core-1.70.0.0 · Universe.Core
  • Functor HintsDefined in plutus-core-1.70.0.0 · UntypedPlutusCore.Transform.Certify.Hints
  • Functor InlinePlusDefined in plutus-core-1.70.0.0 · UntypedPlutusCore.Transform.Certify.Hints
  • Functor AnnotDetailsDefined in pretty-1.1.3.6 · Text.PrettyPrint.Annotated.HughesPJ
  • Functor DocDefined in pretty-1.1.3.6 · Text.PrettyPrint.Annotated.HughesPJ
  • Functor SpanDefined in pretty-1.1.3.6 · Text.PrettyPrint.Annotated.HughesPJ
  • Functor DocDefined in prettyprinter-1.7.2 · Prettyprinter.Internal

    Alter the document’s annotations.

    This instance makes Doc more flexible (because it can be used in Functor-polymorphic values), but fmap is much less readable compared to using reAnnotate in code that only works for Doc anyway. Consider using the latter when the type does not matter.

  • Functor FlattenResultDefined in prettyprinter-1.7.2 · Prettyprinter.Internal
  • Functor SimpleDocStreamDefined in prettyprinter-1.7.2 · Prettyprinter.Internal

    Alter the document’s annotations.

    This instance makes SimpleDocStream more flexible (because it can be used in Functor-polymorphic values), but fmap is much less readable compared to using reAnnotateST in code that only works for SimpleDocStream anyway. Consider using the latter when the type does not matter.

  • Functor SimpleDocTreeDefined in prettyprinter-1.7.2 · Prettyprinter.Render.Util.SimpleDocTree

    Alter the document’s annotations.

    This instance makes SimpleDocTree more flexible (because it can be used in Functor-polymorphic values), but fmap is much less readable compared to using reAnnotateST in code that only works for SimpleDocTree anyway. Consider using the latter when the type does not matter.

  • Functor ArrayDefined in primitive-0.9.1.0 · Data.Primitive.Array
  • Functor SmallArrayDefined in primitive-0.9.1.0 · Data.Primitive.SmallArray
  • Functor IDefined in ral-0.2.2 · Data.RAList.Internal
  • Functor RAListDefined in ral-0.2.2 · Data.RAList.Internal
  • Functor IDefined in ral-0.2.2 · Data.RAList.NonEmpty.Internal
  • Functor NERAListDefined in ral-0.2.2 · Data.RAList.NonEmpty.Internal
  • Functor DirDefined in ral-0.2.2 · Data.RAList.Tree.Internal
  • Functor LeafDefined in ral-0.2.2 · Data.RAList.Tree.Internal
  • Functor PoisonableDefined in rawlock-0.1.2.0 · Control.RAWLock
  • Functor AcquireDefined in resourcet-1.3.0 · Data.Acquire.Internal
  • Functor BlackBoxDefined in small-steps-1.1.4.0 · Control.Provenance
  • Functor IDefined in sop-core-0.5.0.2 · Data.SOP.BasicFunctors
  • Functor LinearTransformDefined in statistics-0.16.5.0 · Statistics.Distribution.Transform
  • Functor PairDefined in statistics-0.16.5.0 · Statistics.Quantile
  • Functor TestDefined in statistics-0.16.5.0 · Statistics.Test.Types
  • Functor STMDefined in stm-2.5.3.1 · Control.Sequential.STM
  • Functor MaybeDefined in strict-0.5.1 · Data.Strict.Maybe
  • Functor StrictListDefined in strict-list-1.0.0.1 · StrictList
  • Functor ParserDefined in tasty-1.5.4 · Test.Tasty.Patterns.Parser
  • Functor WindowDefined in terminal-size-0.3.4 · System.Console.Terminal.Common
  • Functor ValDefined in tree-diff-0.4.1 · Data.TreeDiff.OMap
  • Functor VectorDefined in vector-0.13.2.0 · Data.Vector
  • Functor IdDefined in vector-0.13.2.0 · Data.Vector.Fusion.Util
  • Functor VectorDefined in vector-0.13.2.0 · Data.Vector.Strict
  • Functor BoxDefined in vector-stream-0.1.0.1 · Data.Stream.Monadic
  • Functor BoolPairDefined in witherable-0.5 · Witherable
  • Functor DocDefined in wl-pprint-annotated-0.1.0.2 · Text.PrettyPrint.Annotated.WL
  • Functor SimpleDocDefined in wl-pprint-annotated-0.1.0.2 · Text.PrettyPrint.Annotated.WL
  • Functor YamlParserDefined in yaml-0.11.11.2 · Data.Yaml.Parser
  • Functor []Defined in ghc-internal-9.1401.0 · GHC.Internal.Base
  • () :=> Functor IdentityDefined in constraints-0.14.4 · Data.Constraint
  • () :=> Functor MaybeDefined in constraints-0.14.4 · Data.Constraint
  • () :=> Functor IODefined in constraints-0.14.4 · Data.Constraint
  • () :=> Functor (Either a)Defined in constraints-0.14.4 · Data.Constraint
  • () :=> Functor (Const a)Defined in constraints-0.14.4 · Data.Constraint
  • () :=> Functor (Tuple2 a)Defined in constraints-0.14.4 · Data.Constraint
  • () :=> Functor ((->) a)Defined in constraints-0.14.4 · Data.Constraint
  • () :=> Functor []Defined in constraints-0.14.4 · Data.Constraint
  • Class () (Functor f)Defined in constraints-0.14.4 · Data.Constraint
  • FunctorB b => Functor (Container b)Defined in barbies-2.1.1.0 · Barbies.Internal.Containers
  • FunctorB b => Functor (ErrorContainer b)Defined in barbies-2.1.1.0 · Barbies.Internal.Containers
  • DRG gen => Functor (MonadPseudoRandom gen)Defined in crypton-1.0.6 · Crypto.Random.Types
  • SNatI n => Functor (Tree n)Defined in ral-0.2.2 · Data.RAVec.Tree.DF
  • Functor ProxyDefined in ghc-internal-9.1401.0 · GHC.Internal.Data.Proxy
  • Functor U1Defined in ghc-internal-9.1401.0 · GHC.Internal.Generics
  • Functor V1Defined in ghc-internal-9.1401.0 · GHC.Internal.Generics
  • Functor DefaultsDefined in ouroboros-consensus-4.2.1.0 · Ouroboros.Consensus.Util.Args
  • Functor (Fun a)Defined in QuickCheck-2.18.0.0 · Test.QuickCheck.Function
  • Functor (Shrinking s)Defined in QuickCheck-2.18.0.0 · Test.QuickCheck.Modifiers
  • Functor (PropertyM m)Defined in QuickCheck-2.18.0.0 · Test.QuickCheck.Monadic
  • Functor (TkArray k)Defined in aeson-2.2.5.1 · Data.Aeson.Decoding.Tokens
  • Functor (TkRecord k)Defined in aeson-2.2.5.1 · Data.Aeson.Decoding.Tokens
  • Functor (Tokens k)Defined in aeson-2.2.5.1 · Data.Aeson.Decoding.Tokens
  • Functor (Tagged2 s)Defined in aeson-2.2.5.1 · Data.Aeson.Types.Generic
  • Functor (Graph e)Defined in algebraic-graphs-0.8 · Algebra.Graph.Labelled
  • Functor (MkParser inp)Defined in appar-0.1.8 · Text.Appar.Parser
  • Functor (ConcurrentlyE e)Defined in async-2.2.6 · Control.Concurrent.Async.Internal
  • Functor (IResult i)Defined in attoparsec-0.14.4 · Data.Attoparsec.Internal.Types
  • Functor (Parser i)Defined in attoparsec-0.14.4 · Data.Attoparsec.Internal.Types
  • Functor (St s)Defined in barbies-2.1.1.0 · Barbies.Internal.Writer
  • Functor (Arg a)Defined in base-4.22.0.0 · Data.Semigroup
  • Functor (Vect n)Defined in basement-0.0.16 · Basement.Sized.Vect
  • Functor (Byron depth)Defined in cardano-addresses-4.0.2 · Cardano.Address.Style.Byron
  • Functor (Icarus depth)Defined in cardano-addresses-4.0.2 · Cardano.Address.Style.Icarus
  • Functor (Shared depth)Defined in cardano-addresses-4.0.2 · Cardano.Address.Style.Shared
  • Functor (Shelley depth)Defined in cardano-addresses-4.0.2 · Cardano.Address.Style.Shelley
  • Functor (BuildTxWith build)Defined in cardano-api-11.7.0.0 · Cardano.Api.Tx.Internal.BuildTxWith
  • Functor (ListMap k)Defined in cardano-data-1.3.1.0 · Data.ListMap
  • Functor (Annotated b)Defined in cardano-ledger-binary-1.9.1.0 · Cardano.Ledger.Binary.Decoding.Annotated
  • Functor (Decoder s)Defined in cardano-ledger-binary-1.9.1.0 · Cardano.Ledger.Binary.Decoding.Decoder
  • Functor (Decoder s)Defined in cborg-0.2.10.0 · Codec.CBOR.Decoding
  • Functor (IncrementalDecoder s)Defined in cborg-0.2.10.0 · Codec.CBOR.Read
  • Functor (Map k)Defined in containers-0.8 · Data.Map.Internal
  • Functor (State s)Defined in containers-0.8 · Utils.Containers.Internal.State
  • Functor (Validation e)Defined in either-5.0.3 · Data.Either.Validation
  • Functor (EitherR r)Defined in errors-2.3.0 · Data.EitherR
  • Functor (IntervalMap v)Defined in fingertree-0.1.6.3 · Data.IntervalMap.FingerTree
  • Functor (Node v)Defined in fingertree-0.1.6.3 · Data.IntervalMap.FingerTree
  • Functor (Entry k)Defined in fingertree-0.1.6.3 · Data.PriorityQueue.FingerTree
  • Functor (Fold a)Defined in foldl-1.4.18 · Control.Foldl
  • Functor (Fold1 a)Defined in foldl-1.4.18 · Control.Foldl.NonEmpty
  • Functor (ReverseState s)Defined in foldl-1.4.18 · Control.Scanl
  • Functor (Scan a)Defined in foldl-1.4.18 · Control.Scanl
  • Functor (Format r)Defined in formatting-7.2.0 · Formatting.Internal

    This can be used almost like contramap, e.g:

    formatter :: Format r (b -> r)
    formatter = _
    
    adapter :: a -> b
    adapter = _
    
    adapted :: Format r (a -> r)
    adapted = fmap (. adapter) formatter
    
  • Functor (Parser input)Defined in foundation-0.0.30 · Foundation.Parser
  • Functor (Result input)Defined in foundation-0.0.30 · Foundation.Parser
  • Functor (MonadRandomState gen)Defined in foundation-0.0.30 · Foundation.Random.DRG
  • Functor (Alt f)Defined in free-5.2 · Control.Alternative.Free
  • Functor (AltF f)Defined in free-5.2 · Control.Alternative.Free
  • Functor (Alt f)Defined in free-5.2 · Control.Alternative.Free.Final
  • Functor (Ap f)Defined in free-5.2 · Control.Applicative.Free
  • Functor (Ap f)Defined in free-5.2 · Control.Applicative.Free.Fast
  • Functor (Ap f)Defined in free-5.2 · Control.Applicative.Free.Final
  • Functor (F f)Defined in free-5.2 · Control.Monad.Free.Church
  • Functor (Array i)Defined in ghc-internal-9.1401.0 · GHC.Internal.Arr
  • Functor (ST s)Defined in ghc-internal-9.1401.0 · GHC.Internal.Control.Monad.ST.Lazy.Imp
  • Functor (Either a)Defined in ghc-internal-9.1401.0 · GHC.Internal.Data.Either
  • Functor (StateL s)Defined in ghc-internal-9.1401.0 · GHC.Internal.Data.Functor.Utils
  • Functor (StateR s)Defined in ghc-internal-9.1401.0 · GHC.Internal.Data.Functor.Utils
  • Functor (ST s)Defined in ghc-internal-9.1401.0 · GHC.Internal.ST
  • Functor (Tuple2 a)Defined in ghc-internal-9.1401.0 · GHC.Internal.Base
  • Functor (Subterms n)Defined in hedgehog-1.7 · Hedgehog.Internal.Gen
  • Functor (Vec n)Defined in hedgehog-1.7 · Hedgehog.Internal.Gen
  • Functor (Async s)Defined in io-sim-1.8.0.1 · Control.Monad.IOSim.Types
  • Functor (IOSim s)Defined in io-sim-1.8.0.1 · Control.Monad.IOSim.Types
  • Functor (STM s)Defined in io-sim-1.8.0.1 · Control.Monad.IOSim.Types
  • Functor (Trace a)Defined in io-sim-1.8.0.1 · Data.List.Trace
  • Functor (IPRTable k)Defined in iproute-1.7.15 · Data.IP.RouteTable.Internal
  • Functor (Coyoneda f)Defined in kan-extensions-5.2.8 · Data.Functor.Coyoneda
  • Functor (Yoneda f)Defined in kan-extensions-5.2.8 · Data.Functor.Yoneda
  • Functor (Level i)Defined in lens-5.3.6 · Control.Lens.Internal.Level
  • Functor (ReifiedFold s)Defined in lens-5.3.6 · Control.Lens.Reified
  • Functor (ReifiedGetter s)Defined in lens-5.3.6 · Control.Lens.Reified
  • Functor (LogicT f)Defined in logict-0.8.2.0 · Control.Monad.Logic
  • Functor (Parser byteArray)Defined in memory-0.18.0 · Data.ByteArray.Parse
  • Functor (Pack s)Defined in mempack-0.2.1.0 · Data.MemPack
  • Functor (MonoidalHashMap k)Defined in monoidal-containers-0.6.8.0 · Data.HashMap.Monoidal
  • Functor (MonoidalMap k)Defined in monoidal-containers-0.6.8.0 · Data.Map.Monoidal
  • Functor (MonoidalMap k)Defined in monoidal-containers-0.6.8.0 · Data.Map.Monoidal.Strict
  • Functor (TraceLabelPeer peerid)Defined in network-mux-0.11.0.0 · Network.Mux.Trace
  • Functor (NEMap k)Defined in nonempty-containers-0.4.0.0 · Data.Map.NonEmpty.Lazy.Internal
  • Functor (OMap k)Defined in ordered-containers-0.2.4 · Data.Map.Ordered.Internal
  • Functor (Bias dir)Defined in ordered-containers-0.2.4 · Data.Map.Util
  • Functor (LedgerResult blk)Defined in ouroboros-consensus-4.2.1.0 · Ouroboros.Consensus.Ledger.Basics
  • Functor (Diff k)Defined in ouroboros-consensus-4.2.1.0 · Ouroboros.Consensus.Ledger.Tables.Diff
  • Functor (DiffMK k)Defined in ouroboros-consensus-4.2.1.0 · Ouroboros.Consensus.Ledger.Tables.MapKind
  • Functor (PerasQry xs)Defined in ouroboros-consensus-4.2.1.0 · Ouroboros.Consensus.Peras.Voting.View
  • Functor (IteratorResult blk)Defined in ouroboros-consensus-4.2.1.0 · Ouroboros.Consensus.Storage.ChainDB.API
  • Functor (BlockComponent blk)Defined in ouroboros-consensus-4.2.1.0 · Ouroboros.Consensus.Storage.Common
  • Functor (TraceChunkValidation blk)Defined in ouroboros-consensus-4.2.1.0 · Ouroboros.Consensus.Storage.ImmutableDB.Impl.Types
  • Functor (PeerSelectionView extraViews)Defined in ouroboros-network-1.2.0.0 · Ouroboros.Network.PeerSelection.Governor.Types
  • Functor (EstablishedPeers peeraddr)Defined in ouroboros-network-1.2.0.0 · Ouroboros.Network.PeerSelection.State.EstablishedPeers
  • Functor (TyVarDecl tyname)Defined in plutus-core-1.70.0.0 · PlutusCore.Core.Type
  • Functor (EvaluationError structural)Defined in plutus-core-1.70.0.0 · PlutusCore.Evaluation.Error
  • Functor (ErrorWithCause err)Defined in plutus-core-1.70.0.0 · PlutusCore.Evaluation.ErrorWithCause
  • Functor (UniqueMap unique)Defined in plutus-core-1.70.0.0 · PlutusCore.Name.UniqueMap
  • Functor (UVarDecl name)Defined in plutus-core-1.70.0.0 · UntypedPlutusCore.Core.Type
  • Functor (UniqueParser s)Defined in prettyprinter-1.7.2 · Prettyprinter.Render.Util.SimpleDocTree
  • Functor (InContextM config)Defined in prettyprinter-configurable-1.36.0.0 · Text.PrettyBy.Fixity
  • Functor (IntPSQ p)Defined in psqueues-0.2.8.3 · Data.IntPSQ.Internal
  • Functor (RAVec b)Defined in ral-0.2.2 · Data.RAVec
  • Functor (NERAVec b)Defined in ral-0.2.2 · Data.RAVec.NonEmpty
  • Functor (Tree n)Defined in ral-0.2.2 · Data.RAVec.Tree
  • Functor (ListF a)Defined in recursion-schemes-5.2.3 · Data.Functor.Base
  • Functor (NonEmptyF a)Defined in recursion-schemes-5.2.3 · Data.Functor.Base
  • Functor (TreeF a)Defined in recursion-schemes-5.2.3 · Data.Functor.Base
  • Functor (Over m)Defined in selective-0.7.0.1 · Control.Selective
  • Functor (Under m)Defined in selective-0.7.0.1 · Control.Selective
  • Functor (Validation e)Defined in selective-0.7.0.1 · Control.Selective
  • Functor (Select f)Defined in selective-0.7.0.1 · Control.Selective.Free
  • Functor (Over m)Defined in selective-0.7.0.1 · Control.Selective.Multi
  • Functor (Under m)Defined in selective-0.7.0.1 · Control.Selective.Multi
  • Functor (Select f)Defined in selective-0.7.0.1 · Control.Selective.Rigid.Freer
  • Functor (AtMost xs)Defined in sop-extras-0.4.1.1 · Data.SOP.Counting
  • Functor (Exactly xs)Defined in sop-extras-0.4.1.1 · Data.SOP.Counting
  • Functor (NonEmpty xs)Defined in sop-extras-0.4.1.1 · Data.SOP.NonEmpty
  • Functor (Of a)Defined in streaming-0.2.4.0 · Data.Functor.Of
  • Functor (Either a)Defined in strict-0.5.1 · Data.Strict.Either
  • Functor (These a)Defined in strict-0.5.1 · Data.Strict.These
  • Functor (Pair e)Defined in strict-0.5.1 · Data.Strict.Tuple
  • Functor (IParser t)Defined in text-2.1.3 · Data.Text.Internal.Read
  • Functor (These a)Defined in these-1.2.1 · Data.These
  • Functor (OMap k)Defined in tree-diff-0.4.1 · Data.TreeDiff.OMap
  • Functor (HashMap k)Defined in unordered-containers-0.2.21 · Data.HashMap.Internal
  • Functor (Validation err)Defined in validation-1.3.2 · Data.Validation.Validation
    Example1 expression
    fmap (+1) (Success 2 :: Validation String Int)Success 3
    Example1 expression
    fmap (+1) (Failure "err" :: Validation String Int)Failure "err"
  • Functor (Validation e)Defined in validation-selective-0.2.0.0.0.0.0.0.1 · Validation

    Allows changing the value inside Success with a given function.

    Examples

    Example2 expressions
    fmap (+1) (Success 9)Success 10fmap (+1) (Failure ["wrong"])Failure ["wrong"]
  • Functor (Step s)Defined in vector-stream-0.1.0.1 · Data.Stream.Monadic
  • Functor ((:->) a)Defined in QuickCheck-2.18.0.0 · Test.QuickCheck.Function
  • Functor f => Functor (Co f)Defined in adjunctions-4.4.4 · Data.Functor.Rep
  • Functor f => Functor (Cofree f)Defined in free-5.2 · Control.Comonad.Cofree
  • Functor f => Functor (Free f)Defined in free-5.2 · Control.Monad.Free
  • Functor f => Functor (Free f)Defined in free-5.2 · Control.Monad.Free.Ap
  • Functor f => Functor (Indexing f)Defined in lens-5.3.6 · Control.Lens.Internal.Indexed
  • Functor f => Functor (Indexing64 f)Defined in lens-5.3.6 · Control.Lens.Internal.Indexed
  • Functor f => Functor (First1 f)Defined in lens-5.3.6 · Control.Lens.Lens
  • Functor f => Functor (WrappedPoly f)Defined in mono-traversable-1.0.21.0 · Data.MonoTraversable
  • Functor f => Functor (NERAList' f)Defined in ral-0.2.2 · Data.RAList.NonEmpty.Internal
  • Functor f => Functor (Node f)Defined in ral-0.2.2 · Data.RAList.Tree.Internal
  • Functor f => Functor (SelectA f)Defined in selective-0.7.0.1 · Control.Selective
  • Functor f => Functor (SelectM f)Defined in selective-0.7.0.1 · Control.Selective
  • Functor f => Functor (Select f)Defined in selective-0.7.0.1 · Control.Selective.Rigid.Free
  • Functor f => Functor (Zippy f)Defined in semialign-1.4 · Data.Zip
  • Functor f => Functor (MaybeApply f)Defined in semigroupoids-6.0.2 · Data.Functor.Bind.Class
  • Functor f => Functor (WrappedApplicative f)Defined in semigroupoids-6.0.2 · Data.Functor.Bind.Class
  • Functor f => Functor (Act f)Defined in semigroupoids-6.0.2 · Data.Semigroup.Bifoldable
  • Functor f => Functor (Act f)Defined in semigroupoids-6.0.2 · Data.Semigroup.Foldable
  • Functor f => Functor (Ap f)Defined in tasty-1.5.4 · Test.Tasty.Runners.Reducers
  • Functor f => Functor (Lift f)Defined in transformers-0.6.1.2 · Control.Applicative.Lift
  • Functor f => Functor (WrappedFoldable f)Defined in witherable-0.5 · Witherable
  • Functor m => Functor (ResourceT m)Defined in foundation-0.0.30 · Foundation.Conduit.Internal
  • Functor m => Functor (IdentityT m)Defined in foundation-0.0.30 · Foundation.Monad.Identity
  • Functor m => Functor (GenT m)Defined in hedgehog-1.7 · Hedgehog.Internal.Gen
  • Functor m => Functor (PropertyT m)Defined in hedgehog-1.7 · Hedgehog.Internal.Property
  • Functor m => Functor (TestT m)Defined in hedgehog-1.7 · Hedgehog.Internal.Property
  • Functor m => Functor (NodeT m)Defined in hedgehog-1.7 · Hedgehog.Internal.Tree
  • Functor m => Functor (TreeT m)Defined in hedgehog-1.7 · Hedgehog.Internal.Tree
  • Functor m => Functor (ReadResultT m)Defined in kes-agent-1.3.0.0 · Cardano.KESAgent.Serialization.RawUtil
  • Functor m => Functor (Concurrently m)Defined in lifted-async-0.11.0 · Control.Concurrent.Async.Lifted
  • Functor m => Functor (Concurrently m)Defined in lifted-async-0.11.0 · Control.Concurrent.Async.Lifted.Safe
  • Functor m => Functor (ListT m)Defined in list-t-1.0.5.7 · ListT
  • Functor m => Functor (ML m)Defined in logict-0.8.2.0 · Control.Monad.Logic
  • Functor m => Functor (MLView m)Defined in logict-0.8.2.0 · Control.Monad.Logic
  • Functor m => Functor (FirstToFinish m)Defined in monoidal-synchronisation-0.1.0.8 · Data.Monoid.Synchronisation
  • Functor m => Functor (LastToFinish m)Defined in monoidal-synchronisation-0.1.0.8 · Data.Monoid.Synchronisation
  • Functor m => Functor (LastToFinishM m)Defined in monoidal-synchronisation-0.1.0.8 · Data.Monoid.Synchronisation
  • Functor m => Functor (PerasEnabledT m)Defined in ouroboros-consensus-4.2.1.0 · Ouroboros.Consensus.HardFork.History.EraParams
  • Functor m => Functor (WithEarlyExit m)Defined in ouroboros-consensus-4.2.1.0 · Ouroboros.Consensus.Util.EarlyExit
  • Functor m => Functor (Resource m)Defined in ouroboros-network-1.2.0.0 · Ouroboros.Network.PeerSelection.RootPeersDNS.DNSActions
  • Functor m => Functor (Permutation m)Defined in parser-combinators-1.3.1 · Control.Applicative.Permutations
  • Functor m => Functor (Permutation m)Defined in parser-combinators-1.3.1 · Control.Monad.Permutations
  • Functor m => Functor (Branch m)Defined in parsers-0.12.12 · Text.Parser.Permutation
  • Functor m => Functor (Permutation m)Defined in parsers-0.12.12 · Text.Parser.Permutation
  • Functor m => Functor (Unhighlighted m)Defined in parsers-0.12.12 · Text.Parser.Token
  • Functor m => Functor (Unlined m)Defined in parsers-0.12.12 · Text.Parser.Token
  • Functor m => Functor (Unspaced m)Defined in parsers-0.12.12 · Text.Parser.Token
  • Functor m => Functor (QuoteT m)Defined in plutus-core-1.70.0.0 · PlutusCore.Quote
  • Functor m => Functor (ResourceT m)Defined in resourcet-1.3.0 · Control.Monad.Trans.Resource.Internal
  • Functor m => Functor (QuoteToQuasi m)Defined in th-compat-0.1.7 · Language.Haskell.TH.Syntax.Compat
  • Functor m => Functor (MaybeT m)Defined in transformers-0.6.1.2 · Control.Monad.Trans.Maybe
  • Functor p => Functor (Branch p)Defined in parser-combinators-1.3.1 · Control.Applicative.Permutations
  • Functor s => Functor (ViewL s)Defined in fingertree-0.1.6.3 · Data.FingerTree
  • Functor s => Functor (ViewR s)Defined in fingertree-0.1.6.3 · Data.FingerTree
  • Functor v => Functor (Bootstrap v)Defined in statistics-0.16.5.0 · Statistics.Resampling
  • Functor w => Functor (CoiterT w)Defined in free-5.2 · Control.Comonad.Trans.Coiter
  • Monad m => Functor (ZeptoT m)Defined in attoparsec-0.14.4 · Data.Attoparsec.Zepto
  • Monad m => Functor (WrappedMonad m)Defined in base-4.22.0.0 · Control.Applicative
  • Monad m => Functor (ZipSource m)Defined in conduit-1.3.6.1 · Data.Conduit.Internal.Conduit
  • Monad m => Functor (Handler m)Defined in exceptions-0.10.11 · Control.Monad.Catch
  • Monad m => Functor (CatchT m)Defined in exceptions-0.10.11 · Control.Monad.Catch.Pure
  • Monad m => Functor (IterT m)Defined in free-5.2 · Control.Monad.Trans.Iter
  • Monad m => Functor (ListT m)Defined in optparse-applicative-0.19.0.0 · Options.Applicative.Internal
  • Monad m => Functor (NondetT m)Defined in optparse-applicative-0.19.0.0 · Options.Applicative.Internal
  • Monad m => Functor (ByteStream m)Defined in streaming-bytestring-0.3.4 · Streaming.ByteString.Internal
  • Monad m => Functor (Stream m)Defined in vector-stream-0.1.0.1 · Data.Stream.Monadic
  • Ord k => Functor (PQueue k)Defined in fingertree-0.1.6.3 · Data.PriorityQueue.FingerTree
  • Arrow a => Functor (ArrowMonad a)Defined in ghc-internal-9.1401.0 · GHC.Internal.Control.Arrow
  • Monad m :=> Functor (WrappedMonad m)Defined in constraints-0.14.4 · Data.Constraint
  • Class (Functor f) (Applicative f)Defined in constraints-0.14.4 · Data.Constraint
  • Bifunctor p => Functor (Fix p)Defined in bifunctors-5.6.3 · Data.Bifunctor.Fix
  • Bifunctor p => Functor (Join p)Defined in bifunctors-5.6.3 · Data.Bifunctor.Join
  • Functor (Mag a b)Defined in bifunctors-5.6.3 · Data.Biapplicative
  • Functor (Featured eon era)Defined in cardano-api-11.7.0.0 · Cardano.Api.Era.Internal.Feature
  • Functor (Step s o)Defined in conduit-1.3.6.1 · Data.Conduit.Internal.Fusion
  • Functor (S z s)Defined in dom-lt-0.2.4 · Data.Graph.Dom
  • Functor (FT f m)Defined in free-5.2 · Control.Monad.Trans.Free.Church
  • Functor (Const m)Defined in ghc-internal-9.1401.0 · GHC.Internal.Data.Functor.Const
  • Functor (URec Char)Defined in ghc-internal-9.1401.0 · GHC.Internal.Generics
  • Functor (URec Double)Defined in ghc-internal-9.1401.0 · GHC.Internal.Generics
  • Functor (URec Float)Defined in ghc-internal-9.1401.0 · GHC.Internal.Generics
  • Functor (URec Int)Defined in ghc-internal-9.1401.0 · GHC.Internal.Generics
  • Functor (URec Word)Defined in ghc-internal-9.1401.0 · GHC.Internal.Generics
  • Functor (URec (Ptr ()))Defined in ghc-internal-9.1401.0 · GHC.Internal.Generics
  • Functor (Tuple3 a b)Defined in ghc-internal-9.1401.0 · GHC.Internal.Base
  • Functor (Density f)Defined in kan-extensions-5.2.8 · Control.Comonad.Density
  • Functor (Day f g)Defined in kan-extensions-5.2.8 · Data.Functor.Day
  • Functor (Context a b)Defined in lens-5.3.6 · Control.Lens.Internal.Context
  • Functor (Indexed i a)Defined in lens-5.3.6 · Control.Lens.Internal.Indexed
  • Functor (Flows i b)Defined in lens-5.3.6 · Control.Lens.Internal.Level
  • Functor (Mafic a b)Defined in lens-5.3.6 · Control.Lens.Internal.Magma
  • Functor (Effect m r)Defined in lens-5.3.6 · Control.Lens.Internal.Zoom
  • Functor (ReifiedIndexedFold i s)Defined in lens-5.3.6 · Control.Lens.Reified
  • Functor (ReifiedIndexedGetter i s)Defined in lens-5.3.6 · Control.Lens.Reified
  • Functor (Holes t m)Defined in lens-5.3.6 · Control.Lens.Traversal
  • Functor (Reply e s)Defined in megaparsec-9.8.3 · Text.Megaparsec.Internal
  • Functor (Result s e)Defined in megaparsec-9.8.3 · Text.Megaparsec.Internal
  • Functor (Unpack s b)Defined in mempack-0.2.1.0 · Data.MemPack
  • Functor (Bazaar a b)Defined in microlens-0.4.14.0 · Lens.Micro
  • Functor (Reply s u)Defined in parsec-3.1.18.0 · Text.Parsec.Prim
  • Functor (HeadSpine err a)Defined in plutus-core-1.70.0.0 · PlutusCore.Builtin.KnownType
  • Functor (TyDecl tyname uni)Defined in plutus-core-1.70.0.0 · PlutusCore.Core.Type
  • Functor (Type tyname uni)Defined in plutus-core-1.70.0.0 · PlutusCore.Core.Type
  • Functor (Error uni fun)Defined in plutus-core-1.70.0.0 · PlutusCore.Error
  • Functor (StackMachine output style)Defined in prettyprinter-1.7.2 · Prettyprinter.Render.Util.StackMachine
  • Functor (CopastroSum p a)Defined in profunctors-5.6.3 · Data.Profunctor.Choice
  • Functor (CotambaraSum p a)Defined in profunctors-5.6.3 · Data.Profunctor.Choice
  • Functor (PastroSum p a)Defined in profunctors-5.6.3 · Data.Profunctor.Choice
  • Functor (Environment p a)Defined in profunctors-5.6.3 · Data.Profunctor.Closed
  • Functor (Bar t b)Defined in profunctors-5.6.3 · Data.Profunctor.Mapping
  • Functor (FreeMapping p a)Defined in profunctors-5.6.3 · Data.Profunctor.Mapping
  • Functor (Copastro p a)Defined in profunctors-5.6.3 · Data.Profunctor.Strong
  • Functor (Cotambara p a)Defined in profunctors-5.6.3 · Data.Profunctor.Strong
  • Functor (Pastro p a)Defined in profunctors-5.6.3 · Data.Profunctor.Strong
  • Functor (Baz t b)Defined in profunctors-5.6.3 · Data.Profunctor.Traversing
  • Functor (Bazaar a b)Defined in profunctors-5.6.3 · Data.Profunctor.Traversing
  • Functor (FreeTraversing p a)Defined in profunctors-5.6.3 · Data.Profunctor.Traversing
  • Functor (Coyoneda p a)Defined in profunctors-5.6.3 · Data.Profunctor.Yoneda
  • Functor (Yoneda p a)Defined in profunctors-5.6.3 · Data.Profunctor.Yoneda
  • Functor (Bucket k p)Defined in psqueues-0.2.8.3 · Data.HashPSQ.Internal
  • Functor (HashPSQ k p)Defined in psqueues-0.2.8.3 · Data.HashPSQ.Internal
  • Functor (Elem k p)Defined in psqueues-0.2.8.3 · Data.OrdPSQ.Internal
  • Functor (LTree k p)Defined in psqueues-0.2.8.3 · Data.OrdPSQ.Internal
  • Functor (OrdPSQ k p)Defined in psqueues-0.2.8.3 · Data.OrdPSQ.Internal
  • Functor (NERAVec' n b)Defined in ral-0.2.2 · Data.RAVec.NonEmpty
  • Functor (Clause sts rtype)Defined in small-steps-1.1.4.0 · Control.State.Transition.Extended
  • Functor (K a)Defined in sop-core-0.5.0.2 · Data.SOP.BasicFunctors
  • Functor (Tagged s)Defined in tagged-0.8.11 · Data.Tagged
  • Functor (Constant a)Defined in transformers-0.6.1.2 · Data.Functor.Constant
  • Functor (Validator x err)Defined in validation-1.3.2 · Data.Validation.Validator
    Example2 expressions
    let Validator f = fmap (+1) (Validator Success :: Validator Int [String] Int)f 10Success 11
    Example2 expressions
    let Validator f = fmap (+1) (Validator (\_ -> Failure ["err"]) :: Validator Int [String] Int)f 10Failure ["err"]
  • Functor (ValidatorProfunctor err x)Defined in validation-1.3.2 · Data.Validation.Validator
    Example1 expression
    runVP (fmap (+10) vpFromInput) 3Success 14
    Example1 expression
    runVP (fmap (+10) (vpErr ["e"])) 3Failure ["e"]
  • Functor (bi a) => Functor (Biap bi a)Defined in bifunctors-5.6.3 · Data.Bifunctor.Biap
  • Functor (k (May s)) => Functor (FocusingMay k s)Defined in lens-5.3.6 · Control.Lens.Internal.Zoom
  • Functor (t m) => Functor (LiftingAccum t m)Defined in mtl-2.3.1 · Control.Monad.Accum
  • Functor (t m) => Functor (LiftingSelect t m)Defined in mtl-2.3.1 · Control.Monad.Select
  • Functor f => Functor (CofreeF f a)Defined in free-5.2 · Control.Comonad.Trans.Cofree
  • Functor f => Functor (FreeF f a)Defined in free-5.2 · Control.Monad.Trans.Free
  • Functor f => Functor (FreeF f a)Defined in free-5.2 · Control.Monad.Trans.Free.Ap
  • Functor f => Functor (Ap f)Defined in ghc-internal-9.1401.0 · GHC.Internal.Data.Monoid
  • Functor f => Functor (Alt f)Defined in ghc-internal-9.1401.0 · GHC.Internal.Data.Semigroup.Internal
  • Functor f => Functor (Rec1 f)Defined in ghc-internal-9.1401.0 · GHC.Internal.Generics
  • Functor f => Functor (Indexing f)Defined in indexed-traversable-0.1.5 · WithIndex
  • Functor f => Functor (WrappedFunctor f)Defined in invariant-0.6.5 · Data.Functor.Invariant
  • Functor f => Functor (AlongsideLeft f b)Defined in lens-5.3.6 · Control.Lens.Internal.Getter
  • Functor f => Functor (AlongsideRight f a)Defined in lens-5.3.6 · Control.Lens.Internal.Getter
  • Functor f => Functor (PairT b f)Defined in plutus-core-1.70.0.0 · PlutusPrelude
  • Functor f => Functor (ComposeEither f e)Defined in selective-0.7.0.1 · Control.Selective
  • Functor f => Functor (ExceptT e f)Defined in selective-0.7.0.1 · Control.Selective.Trans.Except
  • Functor f => Functor (Static f a)Defined in semigroupoids-6.0.2 · Data.Semigroupoid.Static
  • Functor f => Functor (Backwards f)Defined in transformers-0.6.1.2 · Control.Applicative.Backwards

    Derived instance.

  • Functor f => Functor (Reverse f)Defined in transformers-0.6.1.2 · Data.Functor.Reverse

    Derived instance.

  • Functor g => Functor (ApF f g)Defined in free-5.2 · Control.Applicative.Trans.Free
  • Functor g => Functor (ApT f g)Defined in free-5.2 · Control.Applicative.Trans.Free
  • Functor g => Functor (Curried g h)Defined in kan-extensions-5.2.8 · Data.Functor.Day.Curried
  • Functor m => Functor (FailT e m)Defined in FailT-0.1.2.0 · Control.Monad.Trans.Fail
  • Functor m => Functor (RandT g m)Defined in MonadRandom-0.6.2.1 · Control.Monad.Trans.Random.Lazy
  • Functor m => Functor (RandT g m)Defined in MonadRandom-0.6.2.1 · Control.Monad.Trans.Random.Strict
  • Functor m => Functor (FoldM m a)Defined in foldl-1.4.18 · Control.Foldl
  • Functor m => Functor (ScanM m a)Defined in foldl-1.4.18 · Control.Scanl
  • Functor m => Functor (ExceptT e m)Defined in foundation-0.0.30 · Foundation.Monad.Except
  • Functor m => Functor (ReaderT r m)Defined in foundation-0.0.30 · Foundation.Monad.Reader
  • Functor m => Functor (StateT s m)Defined in foundation-0.0.30 · Foundation.Monad.State
  • Functor m => Functor (Kleisli m a)Defined in ghc-internal-9.1401.0 · GHC.Internal.Control.Arrow
  • Functor m => Functor (Concurrently m)Defined in io-classes-1.8.0.1 · Control.Monad.Class.MonadAsync
  • Functor m => Functor (Handler m)Defined in io-classes-1.8.0.1 · Control.Monad.Class.MonadThrow
  • Functor m => Functor (StateT s m)Defined in microlens-0.4.14.0 · Lens.Micro
  • Functor m => Functor (Follower m blk)Defined in ouroboros-consensus-4.2.1.0 · Ouroboros.Consensus.Storage.ChainDB.API
  • Functor m => Functor (Iterator m blk)Defined in ouroboros-consensus-4.2.1.0 · Ouroboros.Consensus.Storage.ChainDB.API
  • Functor m => Functor (Iterator m blk)Defined in ouroboros-consensus-4.2.1.0 · Ouroboros.Consensus.Storage.ImmutableDB.API
  • Functor m => Functor (Electric m)Defined in ouroboros-consensus-4.2.1.0 · Ouroboros.Consensus.Util
  • Functor m => Functor (RenameT ren m)Defined in plutus-core-1.70.0.0 · PlutusCore.Rename.Monad
  • Functor m => Functor (WithTempRegistry st m)Defined in resource-registry-0.3.0.0 · Control.ResourceRegistry
  • Functor m => Functor (ProvM t m)Defined in small-steps-1.1.4.0 · Control.Provenance
  • Functor m => Functor (AccumT w m)Defined in transformers-0.6.1.2 · Control.Monad.Trans.Accum
  • Functor m => Functor (ExceptT e m)Defined in transformers-0.6.1.2 · Control.Monad.Trans.Except
  • Functor m => Functor (IdentityT m)Defined in transformers-0.6.1.2 · Control.Monad.Trans.Identity
  • Functor m => Functor (ReaderT r m)Defined in transformers-0.6.1.2 · Control.Monad.Trans.Reader
  • Functor m => Functor (SelectT r m)Defined in transformers-0.6.1.2 · Control.Monad.Trans.Select
  • Functor m => Functor (StateT s m)Defined in transformers-0.6.1.2 · Control.Monad.Trans.State.Lazy
  • Functor m => Functor (StateT s m)Defined in transformers-0.6.1.2 · Control.Monad.Trans.State.Strict
  • Functor m => Functor (WriterT w m)Defined in transformers-0.6.1.2 · Control.Monad.Trans.Writer.CPS
  • Functor m => Functor (WriterT w m)Defined in transformers-0.6.1.2 · Control.Monad.Trans.Writer.Lazy
  • Functor m => Functor (WriterT w m)Defined in transformers-0.6.1.2 · Control.Monad.Trans.Writer.Strict
  • Functor m => Functor (ValidationMonadT err m)Defined in validation-1.3.2 · Data.Validation.ValidationMonad
    Example1 expression
    fmap (+1) (ValidationMonadT (Identity (Success 2)) :: ValidationMonadT String Identity Int)ValidationMonadT (Identity (Success 3))
    Example1 expression
    fmap (+1) (ValidationMonadT (Identity (Failure "err")) :: ValidationMonadT String Identity Int)ValidationMonadT (Identity (Failure "err"))
  • Functor w => Functor (EnvT e w)Defined in comonad-5.0.10 · Control.Comonad.Trans.Env
  • Functor w => Functor (StoreT s w)Defined in comonad-5.0.10 · Control.Comonad.Trans.Store
  • Functor w => Functor (TracedT m w)Defined in comonad-5.0.10 · Control.Comonad.Trans.Traced
  • Monad m => Functor (Reader r m)Defined in basement-0.0.16 · Basement.Compat.MonadTrans
  • Monad m => Functor (State s m)Defined in basement-0.0.16 · Basement.Compat.MonadTrans
  • Monad m => Functor (ZipSink i m)Defined in conduit-1.3.6.1 · Data.Conduit.Internal.Conduit
  • Monad m => Functor (ExceptRT r m)Defined in errors-2.3.0 · Data.EitherR
  • Monad m => Functor (ZipSink i m)Defined in foundation-0.0.30 · Foundation.Conduit.Internal
  • Monad m => Functor (StateT s m)Defined in ghc-internal-9.1401.0 · GHC.Internal.Data.Functor.Utils
  • Monad m => Functor (Focusing m s)Defined in lens-5.3.6 · Control.Lens.Internal.Zoom
  • Monad m => Functor (Handler e m)Defined in lens-5.3.6 · Control.Monad.Error.Lens
  • Monad m => Functor (Bundle m v)Defined in vector-0.13.2.0 · Data.Vector.Fusion.Bundle.Monadic
  • Arrow a => Functor (WrappedArrow a b)Defined in base-4.22.0.0 · Control.Applicative
  • Profunctor p => Functor (TambaraSum p a)Defined in profunctors-5.6.3 · Data.Profunctor.Choice
  • Profunctor p => Functor (Closure p a)Defined in profunctors-5.6.3 · Data.Profunctor.Closed
  • Profunctor p => Functor (Coprep p)Defined in profunctors-5.6.3 · Data.Profunctor.Rep
  • Profunctor p => Functor (Prep p)Defined in profunctors-5.6.3 · Data.Profunctor.Rep
  • Profunctor p => Functor (Tambara p a)Defined in profunctors-5.6.3 · Data.Profunctor.Strong
  • (Contravariant f, Contravariant g) => Functor (Compose f g)Defined in contravariant-1.5.6 · Data.Functor.Contravariant.Compose
  • (Applicative f, Monad f) => Functor (WhenMissing f x)Defined in containers-0.8 · Data.IntMap.Internal
  • (Functor f, Functor g) => Functor (ComposeCF f g)Defined in contravariant-1.5.6 · Data.Functor.Contravariant.Compose
  • (Functor f, Functor g) => Functor (ComposeFC f g)Defined in contravariant-1.5.6 · Data.Functor.Contravariant.Compose
  • (Functor f, Functor g) => Functor (ComposeTraversable f g)Defined in selective-0.7.0.1 · Control.Selective
  • (Functor f, Functor g) => Functor (These1 f g)Defined in these-1.2.1 · Data.Functor.These
  • (Functor f, Functor m) => Functor (ReaderT f m)Defined in adjunctions-4.4.4 · Control.Monad.Representable.Reader
  • (Functor f, Functor m) => Functor (FreeT f m)Defined in free-5.2 · Control.Monad.Trans.Free
  • (Functor f, Functor m) => Functor (FreeT f m)Defined in free-5.2 · Control.Monad.Trans.Free.Ap
  • (Functor f, Functor w) => Functor (CofreeT f w)Defined in free-5.2 · Control.Comonad.Trans.Cofree
  • (Functor f, Monad m) => Functor (Stream f m)Defined in streaming-0.2.4.0 · Streaming.Internal

    Operates covariantly on the stream result, not on its elements:

    Stream (Of a) m r
               ^    ^
               |    `--- This is what Functor and Applicative use
               `--- This is what functions like S.map/S.zipWith use
    
  • (Functor g, Functor m) => Functor (StateT g m)Defined in adjunctions-4.4.4 · Control.Monad.Representable.State
  • (Functor w, Functor g) => Functor (StoreT g w)Defined in adjunctions-4.4.4 · Control.Comonad.Representable.Store
  • (Generic1 f, Functor (Rep1 f)) => Functor (Generically1 f)Defined in ghc-internal-9.1401.0 · GHC.Internal.Generics
  • Lifting Functor LiftDefined in constraints-0.14.4 · Data.Constraint.Lifting
  • Lifting Functor MaybeTDefined in constraints-0.14.4 · Data.Constraint.Lifting
  • Lifting Functor BackwardsDefined in constraints-0.14.4 · Data.Constraint.Lifting
  • Lifting Functor IdentityTDefined in constraints-0.14.4 · Data.Constraint.Lifting
  • Lifting Functor ReverseDefined in constraints-0.14.4 · Data.Constraint.Lifting
  • Lifting Functor (ExceptT e)Defined in constraints-0.14.4 · Data.Constraint.Lifting
  • Lifting Functor (ReaderT e)Defined in constraints-0.14.4 · Data.Constraint.Lifting
  • Lifting Functor (StateT s)Defined in constraints-0.14.4 · Data.Constraint.Lifting
  • Lifting Functor (StateT s)Defined in constraints-0.14.4 · Data.Constraint.Lifting
  • Lifting Functor (WriterT w)Defined in constraints-0.14.4 · Data.Constraint.Lifting
  • Lifting Functor (WriterT w)Defined in constraints-0.14.4 · Data.Constraint.Lifting
  • Lifting2 Functor ProductDefined in constraints-0.14.4 · Data.Constraint.Lifting
  • Lifting2 Functor SumDefined in constraints-0.14.4 · Data.Constraint.Lifting
  • Lifting Functor (ContT r)Defined in constraints-0.14.4 · Data.Constraint.Lifting
  • Functor f => Lifting Functor (Product f)Defined in constraints-0.14.4 · Data.Constraint.Lifting
  • Functor f => Lifting Functor (Sum f)Defined in constraints-0.14.4 · Data.Constraint.Lifting
  • Lifting2 Functor ComposeDefined in constraints-0.14.4 · Data.Constraint.Lifting
  • Lifting Functor (RWST r w s)Defined in constraints-0.14.4 · Data.Constraint.Lifting
  • Lifting Functor (RWST r w s)Defined in constraints-0.14.4 · Data.Constraint.Lifting
  • Functor f => Lifting Functor (Compose f)Defined in constraints-0.14.4 · Data.Constraint.Lifting
  • Functor (Cokleisli w a)Defined in comonad-5.0.10 · Control.Comonad
  • Functor (ConduitT i o m)Defined in conduit-1.3.6.1 · Data.Conduit.Internal.Conduit
  • Functor (ZipConduit i o m)Defined in conduit-1.3.6.1 · Data.Conduit.Internal.Conduit
  • Functor (Conduit i o m)Defined in foundation-0.0.30 · Foundation.Conduit.Internal
  • Functor (K1 i c)Defined in ghc-internal-9.1401.0 · GHC.Internal.Generics
  • Functor (Tuple4 a b c)Defined in ghc-internal-9.1401.0 · GHC.Internal.Base
  • Functor (Codensity k)Defined in kan-extensions-5.2.8 · Control.Monad.Codensity
  • Functor (Lan f g)Defined in kan-extensions-5.2.8 · Data.Functor.Kan.Lan
  • Functor (Ran g h)Defined in kan-extensions-5.2.8 · Data.Functor.Kan.Ran
  • Functor (Bazaar p a b)Defined in lens-5.3.6 · Control.Lens.Internal.Bazaar
  • Functor (Bazaar1 p a b)Defined in lens-5.3.6 · Control.Lens.Internal.Bazaar
  • Functor (Pretext p a b)Defined in lens-5.3.6 · Control.Lens.Internal.Context
  • Functor (Exchange a b s)Defined in lens-5.3.6 · Control.Lens.Internal.Iso
  • Functor (Magma i t b)Defined in lens-5.3.6 · Control.Lens.Internal.Magma
  • Functor (Molten i a b)Defined in lens-5.3.6 · Control.Lens.Internal.Magma
  • Functor (Market a b s)Defined in lens-5.3.6 · Control.Lens.Internal.Prism
  • Functor (ParsecT e s m)Defined in megaparsec-9.8.3 · Text.Megaparsec.Internal
  • Functor (ParsecT s u m)Defined in parsec-3.1.18.0 · Text.Parsec.Prim
  • Functor (VarDecl tyname name uni)Defined in plutus-core-1.70.0.0 · PlutusCore.Core.Type
  • Functor (TypeError term uni fun)Defined in plutus-core-1.70.0.0 · PlutusCore.Error
  • Functor (UnrestrictedProgram name uni fun)Defined in plutus-core-1.70.0.0 · UntypedPlutusCore.Core.Instance.Flat
  • Functor (Program name uni fun)Defined in plutus-core-1.70.0.0 · UntypedPlutusCore.Core.Type
  • Functor (Term name uni fun)Defined in plutus-core-1.70.0.0 · UntypedPlutusCore.Core.Type
  • Functor (CekM uni fun s)Defined in plutus-core-1.70.0.0 · UntypedPlutusCore.Evaluation.Machine.Cek.Internal
  • Functor (Costar f a)Defined in profunctors-5.6.3 · Data.Profunctor.Types
  • Functor (Forget r a)Defined in profunctors-5.6.3 · Data.Profunctor.Types
  • Functor (ContT r m)Defined in transformers-0.6.1.2 · Control.Monad.Trans.Cont
  • Functor ((->) r)Defined in ghc-internal-9.1401.0 · GHC.Internal.Base
  • Functor (f (g m)) => Functor (ComposeT f g m)Defined in mmorph-1.2.2 · Control.Monad.Trans.Compose
  • Functor (k (Err e s)) => Functor (FocusingErr e k s)Defined in lens-5.3.6 · Control.Lens.Internal.Zoom
  • Functor (k (f s)) => Functor (FocusingOn f k s)Defined in lens-5.3.6 · Control.Lens.Internal.Zoom
  • Functor (k (s, w)) => Functor (FocusingPlus w k s)Defined in lens-5.3.6 · Control.Lens.Internal.Zoom
  • Functor f => Functor (WhenMatched f x y)Defined in containers-0.8 · Data.IntMap.Internal
  • Functor f => Functor (Star f a)Defined in profunctors-5.6.3 · Data.Profunctor.Types
  • Functor f => Functor (ValidatorMonadProfunctorT err f x)Defined in validation-1.3.2 · Data.Validation.Validator
    Example4 expressions
    import Control.Lens(view, _Wrapped')let v = ValidatorMonadProfunctorT (\x -> ValidationMonadT (Identity (Success (x + 1)))) :: ValidatorMonadProfunctorT [String] Identity Int Intlet ValidationMonadT (Identity r) = (view _Wrapped' (fmap (*10) v)) 3rSuccess 40
  • Functor f => Functor (ValidatorMonadT x err f)Defined in validation-1.3.2 · Data.Validation.Validator
    Example5 expressions
    import Data.Functor.Identity (Identity(..))import Data.Validation.Validation (Validation(..))import Data.Validation.ValidationMonad (ValidationMonadT(..))let v = ValidatorMonadT (\_ -> ValidationMonadT (Identity (Success 1))) :: ValidatorMonadT Int [String] Identity Intlet ValidatorMonadT f = fmap (+1) v in let ValidationMonadT (Identity r) = f 0 in rSuccess 2
  • Functor m => Functor (DecodeStep bytes failure m)Defined in typed-protocols-1.2.2.0 · Network.TypedProtocol.Codec
  • Functor w => Functor (ContsT r w m)Defined in adjunctions-4.4.4 · Control.Monad.Trans.Conts
  • Functor w => Functor (CoT w m)Defined in kan-extensions-5.2.8 · Control.Monad.Co
  • Monad m => Functor (FocusingWith w m s)Defined in lens-5.3.6 · Control.Lens.Internal.Zoom
  • (Adjunction f g, Functor w) => Functor (AdjointT f g w)Defined in adjunctions-4.4.4 · Control.Comonad.Trans.Adjoint
  • (Adjunction f g, Monad m) => Functor (AdjointT f g m)Defined in adjunctions-4.4.4 · Control.Monad.Trans.Adjoint
  • (Adjunction f g, Functor w) => Functor (AdjointT f g w)Defined in adjunctions-4.4.4 · Control.Monad.Trans.Contravariant.Adjoint
  • (Applicative f, Monad f) => Functor (WhenMissing f k x)Defined in containers-0.8 · Data.Map.Internal
  • (Functor f, Functor g) => Functor (Product f g)Defined in base-4.22.0.0 · Data.Functor.Product
  • (Functor f, Functor g) => Functor (Sum f g)Defined in base-4.22.0.0 · Data.Functor.Sum
  • (Functor f, Functor g) => Functor (f :*: g)Defined in ghc-internal-9.1401.0 · GHC.Internal.Generics
  • (Functor f, Functor g) => Functor (f :+: g)Defined in ghc-internal-9.1401.0 · GHC.Internal.Generics
  • Bifunctor p => Functor (Flip p a)Defined in bifunctors-5.6.3 · Data.Bifunctor.Flip
  • Bifunctor p => Functor (WrappedBifunctor p a)Defined in bifunctors-5.6.3 · Data.Bifunctor.Wrapped
  • Functor (Clown f a)Defined in bifunctors-5.6.3 · Data.Bifunctor.Clown
  • Functor (Tuple5 a b c d)Defined in ghc-internal-9.1401.0 · GHC.Internal.Base
  • Functor (BazaarT p g a b)Defined in lens-5.3.6 · Control.Lens.Internal.Bazaar
  • Functor (BazaarT1 p g a b)Defined in lens-5.3.6 · Control.Lens.Internal.Bazaar
  • Functor (PretextT p g a b)Defined in lens-5.3.6 · Control.Lens.Internal.Context
  • Functor (TakingWhile p f a b)Defined in lens-5.3.6 · Control.Lens.Internal.Magma
  • Functor (EffectRWS w st m s)Defined in lens-5.3.6 · Control.Lens.Internal.Zoom
  • Functor (K2 a b)Defined in ouroboros-consensus-4.2.1.0 · Ouroboros.Consensus.Ledger.Tables.Combinators
  • Functor (Program tyname name uni fun)Defined in plutus-core-1.70.0.0 · PlutusCore.Core.Type
  • Functor (Term tyname name uni fun)Defined in plutus-core-1.70.0.0 · PlutusCore.Core.Type
  • Functor (NormCheckError tyname name uni fun)Defined in plutus-core-1.70.0.0 · PlutusCore.Error
  • Functor (DebugF uni fun ann bps)Defined in plutus-core-1.70.0.0 · UntypedPlutusCore.Evaluation.Machine.SteppableCek.DebugDriver
  • Functor (k (Freed f m s)) => Functor (FocusingFree f m k s)Defined in lens-5.3.6 · Control.Lens.Internal.Zoom
  • Functor f => Functor (WhenMatched f k x y)Defined in containers-0.8 · Data.Map.Internal
  • Functor f => Functor (M1 i c f)Defined in ghc-internal-9.1401.0 · GHC.Internal.Generics
  • Functor g => Functor (Joker g a)Defined in bifunctors-5.6.3 · Data.Bifunctor.Joker
  • Functor m => Functor (NormalizeTypeT m tyname uni ann)Defined in plutus-core-1.70.0.0 · PlutusCore.Normalize.Internal
  • Functor m => Functor (RWST r w s m)Defined in transformers-0.6.1.2 · Control.Monad.Trans.RWS.CPS
  • Functor m => Functor (RWST r w s m)Defined in transformers-0.6.1.2 · Control.Monad.Trans.RWS.Lazy
  • Functor m => Functor (RWST r w s m)Defined in transformers-0.6.1.2 · Control.Monad.Trans.RWS.Strict
  • Functor m => Functor (PeerLookahead ps pr st m)Defined in typed-protocols-1.2.2.0 · Network.TypedProtocol.Peer
  • Functor m => Functor (PeerLookaheadFixedSender ps pr st m)Defined in typed-protocols-1.2.2.0 · Network.TypedProtocol.Peer
  • Functor m => Functor (PeerPipelined ps pr st m)Defined in typed-protocols-1.2.2.0 · Network.TypedProtocol.Peer
  • Profunctor p => Functor (Codensity p a)Defined in profunctors-5.6.3 · Data.Profunctor.Ran
  • Reifies s (ReifiedApplicative f) => Functor (ReflectedApplicative f s)Defined in reflection-2.1.9 · Data.Reflection
  • (Functor f, Functor g) => Functor (Compose f g)Defined in base-4.22.0.0 · Data.Functor.Compose
  • (Functor f, Functor g) => Functor (f :.: g)Defined in ghc-internal-9.1401.0 · GHC.Internal.Generics
  • (Functor f, Functor g) => Functor (f :.: g)Defined in sop-core-0.5.0.2 · Data.SOP.BasicFunctors
  • Applicative m => Functor (Pipe l i o u m)Defined in foundation-0.0.30 · Foundation.Conduit.Internal
  • Functor (LocalStateQueryExpr block point query r m)Defined in cardano-api-11.7.0.0 · Cardano.Api.Network.IPC.Internal.Monad
  • Functor (Tuple6 a b c d e)Defined in ghc-internal-9.1401.0 · GHC.Internal.Base
  • Functor m => Functor (OptimizerT name uni fun ann m)Defined in plutus-core-1.70.0.0 · UntypedPlutusCore.Transform.Optimizer
  • Functor m => Functor (Peer ps pr pl st m)Defined in typed-protocols-1.2.2.0 · Network.TypedProtocol.Peer
  • Functor m => Functor (Receiver ps pr st stdone m)Defined in typed-protocols-1.2.2.0 · Network.TypedProtocol.Peer
  • Monad m => Functor (Pipe l i o u m)Defined in conduit-1.3.6.1 · Data.Conduit.Internal.Pipe
  • Monad state => Functor (Builder collection mutCollection step state err)Defined in basement-0.0.16 · Basement.MutableBuilder
  • (Functor (f a), Functor (g a)) => Functor (Product f g a)Defined in bifunctors-5.6.3 · Data.Bifunctor.Product
  • (Functor (f a), Functor (g a)) => Functor (Sum f g a)Defined in bifunctors-5.6.3 · Data.Bifunctor.Sum
  • Functor (Tuple7 a b c d e f)Defined in ghc-internal-9.1401.0 · GHC.Internal.Base
  • Profunctor p => Functor (Procompose p q a)Defined in profunctors-5.6.3 · Data.Profunctor.Composition
  • Profunctor p => Functor (Rift p q a)Defined in profunctors-5.6.3 · Data.Profunctor.Composition
  • Profunctor q => Functor (Ran p q a)Defined in profunctors-5.6.3 · Data.Profunctor.Ran
  • (Functor f, Bifunctor p) => Functor (Tannen f p a)Defined in bifunctors-5.6.3 · Data.Bifunctor.Tannen
  • (Functor f, Functor (g a)) => Functor ((:..:) f g a)Defined in ouroboros-consensus-4.2.1.0 · Ouroboros.Consensus.Ledger.Tables.Combinators
  • (Bifunctor p, Functor g) => Functor (Biff p f g a)Defined in bifunctors-5.6.3 · Data.Bifunctor.Biff
newtypenewtype Const a (b :: k)
#

The Const functor.

Examples
Example1 expression
fmap (++ "World") (Const "Hello")Const "Hello"

Because we ignore the second type parameter to Const, the Applicative instance, which has (<*>) :: Monoid m => Const m (a -> b) -> Const m a -> Const m b essentially turns into Monoid m => m -> m -> m, which is (<>)

Example1 expression
Const [1, 2, 3] <*> Const [4, 5, 6]Const [1,2,3,4,5,6]

Constructors

Instances143Semigroupoid, Generic1, FoldableWithIndex, FunctorWithIndex, TraversableWithIndex, ApplicativeB, …
newtypenewtype ZipList a
#

Lists, but with an Applicative functor based on zipping.

Examples

In contrast to the Applicative for GHC.List.List:

Example1 expression
(+) <$> [1, 2, 3] <*> [4, 5, 6][5,6,7,6,7,8,7,8,9]

The Applicative instance of ZipList applies the operation by pairing up the elements, analogous to zipWithN

Example1 expression
(+) <$> ZipList [1, 2, 3] <*> ZipList [4, 5, 6]ZipList {getZipList = [5,7,9]}
Example1 expression
(,,,) <$> ZipList [1, 2] <*> ZipList [3, 4] <*> ZipList [5, 6] <*> ZipList [7, 8]ZipList {getZipList = [(1,3,5,7),(2,4,6,8)]}
Example1 expression
ZipList [(+1), (^2), (/ 2)] <*> ZipList [5, 5, 5]ZipList {getZipList = [6.0,25.0,2.5]}

Constructors

Instances53Functor, Applicative, Foldable, Traversable, Alternative, NFData1, …
datadata ParseError
#

The abstract data type ParseError represents parse errors. It provides the source position (SourcePos) of the error and a list of error messages (Message). A ParseError can be returned by the function parse. ParseError is an instance of the Show and Eq classes.

Instances4Eq, Show, Exception, Error
datadata Operator s u (m :: Type -> Type) a
#

This data type specifies operators that work on values of type a. An operator is either binary infix or unary prefix or postfix. A binary operator has also an associated associativity.

Constructors

datadata SourcePos
#

The abstract data type SourcePos represents source positions. It contains the name of the source (i.e. file name), a line number and a column number. SourcePos is an instance of the Show, Eq and Ord class.

Instances4Eq, Data, Ord, Show
newtypenewtype ParsecT s u (m :: Type -> Type) a
#

ParserT monad transformer and Parser type

ParsecT s u m a is a parser with stream type s, user state type u, underlying monad m and return type a. Parsec is strict in the user state. If this is undesirable, simply use a data type like data Box a = Box a and the state type Box YourStateType to add a level of indirection.

Instances18MonadError, MonadReader, MonadState, MonadTrans, Monad, Functor, …
classclass Monad m => Stream s (m :: Type -> Type) t | s -> t where
#

An instance of Stream has stream type s, underlying monad m and token type t determined by the stream

Some rough guidelines for a "correct" instance of Stream:

  • unfoldM uncons gives the [t] corresponding to the stream

  • A Stream instance is responsible for maintaining the "position within the stream" in the stream state s. This is trivial unless you are using the monad in a non-trivial way.

Methods

Instances5Stream