| Safe Haskell | None |
|---|---|
| Language | Haskell98 |
Text.Papillon.Core
- papillonCore :: String -> DecsQ
- class Source sl where
- class SourceList c where
- data 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 => forall a b. 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 #
Minimal complete definition
Instances
| Source ByteString Source # | |
| SourceList c => Source [c] Source # | |
class SourceList c where Source #
Minimal complete definition
Methods
listToken :: [c] -> Maybe (c, [c]) Source #
listInitialPos :: ListPos c Source #
listUpdatePos :: c -> ListPos c -> ListPos c Source #
Instances
For parse error message
data ParseError pos drv Source #
Instances
| Error (ParseError pos drv) Source # | |
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 => forall a b. f (a -> b) -> f a -> f b #
Sequential application.
(<$>) :: 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)