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 #
Minimal complete definition
Instances
Source ByteString # | |
SourceList c => Source [c] # | |
class SourceList c where #
Minimal complete definition
Methods
listToken :: [c] -> Maybe (c, [c]) #
listInitialPos :: ListPos c #
listUpdatePos :: c -> ListPos c -> ListPos c #
Instances
For parse error message
data ParseError pos drv #
Instances
Error (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) #
For papillon command
type ModuleName = [String] #
(<*>) :: Applicative f => forall a b. 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)