Safe Haskell | None |
---|---|
Language | Haskell98 |
Synopsis
- papillon :: QuasiQuoter
- class Source sl where
- class SourceList c where
- data ListPos c
- listToken :: [c] -> Maybe (c, [c])
- listInitialPos :: ListPos c
- listUpdatePos :: c -> ListPos c -> ListPos c
- data ParseError pos drv
- mkParseError :: forall pos drv. String -> String -> String -> drv -> [String] -> pos -> ParseError pos drv
- peDerivs :: ParseError pos drv -> drv
- peReading :: ParseError pos drv -> [String]
- peMessage :: ParseError pos drv -> String
- peCode :: ParseError pos drv -> String
- peComment :: ParseError pos drv -> String
- pePosition :: ParseError pos drv -> pos
- pePositionS :: forall drv. ParseError (Pos String) drv -> (Int, Int)
- (<*>) :: Applicative f => f (a -> b) -> f a -> f b
- (<$>) :: Functor f => (a -> b) -> f a -> f b
- runError :: forall err a. ErrorT err Identity a -> Either err a
Documentation
class Source sl where Source #
Instances
Source ByteString Source # | |
Defined in Text.Papillon.Papillon type Token ByteString :: Type Source # data Pos ByteString :: Type Source # getToken :: ByteString -> Maybe (Token ByteString, ByteString) Source # initialPos :: Pos ByteString Source # updatePos :: Token ByteString -> Pos ByteString -> Pos ByteString Source # | |
SourceList c => Source [c] Source # | |
class SourceList c where Source #
For parse error message
data ParseError pos drv Source #
Instances
Error (ParseError pos drv) Source # | |
Defined in Text.Papillon.Papillon noMsg :: ParseError pos drv # strMsg :: String -> ParseError pos drv # |
mkParseError :: forall pos drv. String -> String -> String -> drv -> [String] -> pos -> ParseError pos drv Source #
peDerivs :: ParseError pos drv -> drv Source #
peReading :: ParseError pos drv -> [String] Source #
peMessage :: ParseError pos drv -> String Source #
peCode :: ParseError pos drv -> String Source #
peComment :: ParseError pos drv -> String Source #
pePosition :: ParseError pos drv -> pos Source #
pePositionS :: forall drv. ParseError (Pos String) drv -> (Int, Int) Source #
(<*>) :: Applicative f => f (a -> b) -> f a -> f b infixl 4 #
Sequential application.
A few functors support an implementation of <*>
that is more
efficient than the default one.
(<$>) :: Functor f => (a -> b) -> f a -> f b infixl 4 #
An infix synonym for fmap
.
The name of this operator is an allusion to $
.
Note the similarities between their types:
($) :: (a -> b) -> a -> b (<$>) :: Functor f => (a -> b) -> f a -> f b
Whereas $
is function application, <$>
is function
application lifted over a Functor
.
Examples
Convert from a
to a Maybe
Int
using Maybe
String
show
:
>>>
show <$> Nothing
Nothing>>>
show <$> Just 3
Just "3"
Convert from an
to an Either
Int
Int
Either
Int
String
using show
:
>>>
show <$> Left 17
Left 17>>>
show <$> Right 17
Right "17"
Double each element of a list:
>>>
(*2) <$> [1,2,3]
[2,4,6]
Apply even
to the second element of a pair:
>>>
even <$> (2,2)
(2,True)