| Safe Haskell | None |
|---|---|
| Language | Haskell98 |
Text.Papillon.Core
Synopsis
- papillonCore :: String -> DecsQ
- 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)
- papillonFile :: String -> Q ([PPragma], ModuleName, Maybe Exports, Code, DecsQ, Code)
- data PPragma
- type ModuleName = [String]
- type Exports = String
- type Code = String
- (<*>) :: 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
For Text.Papillon library
papillonCore :: String -> DecsQ Source #
class Source sl where Source #
Instances
| Source ByteString Source # | |
Defined in Text.Papillon.Papillon Methods 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 | |
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 #
For papillon command
Constructors
| LanguagePragma [String] | |
| OtherPragma String |
type ModuleName = [String] 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 Stringshow:
>>>show <$> NothingNothing>>>show <$> Just 3Just "3"
Convert from an to an Either Int IntEither IntString using show:
>>>show <$> Left 17Left 17>>>show <$> Right 17Right "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)