shakespeare-2.0.20: A toolkit for making compile-time interpolated templates

Safe Haskell | None
Language | Haskell98

Text.Shakespeare.Base

Description

General parsers, functions and datatypes for all Shakespeare languages.

Synopsis

- data Deref
  - = DerefModulesIdent [String] Ident
  - | DerefIdent Ident
  - | DerefIntegral Integer
  - | DerefRational Rational
  - | DerefString String
  - | DerefBranch Deref Deref
  - | DerefList [Deref]
  - | DerefTuple [Deref]
- newtype Ident = Ident String
- type Scope = [(Ident, Exp)]
- parseDeref :: UserParser a Deref
- parseHash :: UserParser a (Either String Deref)
- parseVar :: Char -> UserParser a (Either String Deref)
- parseVarString :: Char -> UserParser a (Either String String)
- parseAt :: UserParser a (Either String (Deref, Bool))
- parseUrl :: Char -> Char -> UserParser a (Either String (Deref, Bool))
- parseUrlString :: Char -> Char -> UserParser a (Either String String)
- parseCaret :: UserParser a (Either String Deref)
- parseUnder :: UserParser a (Either String Deref)
- parseInt :: Char -> UserParser a (Either String Deref)
- parseIntString :: Char -> UserParser a (Either String String)
- derefToExp :: Scope -> Deref -> Exp
- flattenDeref :: Deref -> Maybe [String]
- readUtf8File :: FilePath -> IO Text
- readUtf8FileString :: FilePath -> IO String
- readFileQ :: FilePath -> Q String
- readFileRecompileQ :: FilePath -> Q String

# Documentation

data Deref Source #

Constructors

DerefModulesIdent [String] Ident |
DerefIdent Ident |
DerefIntegral Integer |
DerefRational Rational |
DerefString String |
DerefBranch Deref Deref |
DerefList [Deref] |
DerefTuple [Deref] |

Instances

Eq Deref Source # |
Instance details Defined in Text.Shakespeare.Base Methods (==) :: Deref -> Deref -> Bool Source # (/=) :: Deref -> Deref -> Bool Source #
Data Deref Source # |

Instance details

Defined in Text.Shakespeare.Base

Methods

gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> Deref -> c Deref Source #

gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c Deref Source #

toConstr :: Deref -> Constr Source #

dataTypeOf :: Deref -> DataType Source #

dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c Deref) Source #

dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Deref) Source #

gmapT :: (forall b. Data b => b -> b) -> Deref -> Deref Source #

gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Deref -> r Source #

gmapQr :: (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Deref -> r Source #

gmapQ :: (forall d. Data d => d -> u) -> Deref -> [u] Source #

gmapQi :: Int -> (forall d. Data d => d -> u) -> Deref -> u Source #

gmapM :: Monad m => (forall d. Data d => d -> m d) -> Deref -> m Deref Source #

gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> Deref -> m Deref Source #

gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> Deref -> m Deref Source #

Ord Deref Source # |
Instance details Defined in Text.Shakespeare.Base Methods compare :: Deref -> Deref -> Ordering Source # (<) :: Deref -> Deref -> Bool Source # (<=) :: Deref -> Deref -> Bool Source # (>) :: Deref -> Deref -> Bool Source # (>=) :: Deref -> Deref -> Bool Source # max :: Deref -> Deref -> Deref Source # min :: Deref -> Deref -> Deref Source #
Read Deref Source # |
Instance details Defined in Text.Shakespeare.Base Methods readsPrec :: Int -> ReadS Deref Source # readList :: ReadS [Deref] Source # readPrec :: ReadPrec Deref Source # readListPrec :: ReadPrec [Deref] Source #
Show Deref Source # |
Instance details Defined in Text.Shakespeare.Base Methods showsPrec :: Int -> Deref -> ShowS Source # show :: Deref -> String Source # showList :: [Deref] -> ShowS Source #
Lift Deref Source # |
Instance details Defined in Text.Shakespeare.Base Methods lift :: Deref -> Q Exp Source #

newtype Ident Source #

Constructors

Ident String |

Instances

Eq Ident Source # |
Instance details Defined in Text.Shakespeare.Base Methods (==) :: Ident -> Ident -> Bool Source # (/=) :: Ident -> Ident -> Bool Source #
Data Ident Source # |

Instance details

Defined in Text.Shakespeare.Base

Methods

gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> Ident -> c Ident Source #

gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c Ident Source #

toConstr :: Ident -> Constr Source #

dataTypeOf :: Ident -> DataType Source #

dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c Ident) Source #

dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Ident) Source #

gmapT :: (forall b. Data b => b -> b) -> Ident -> Ident Source #

gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Ident -> r Source #

gmapQr :: (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Ident -> r Source #

gmapQ :: (forall d. Data d => d -> u) -> Ident -> [u] Source #

gmapQi :: Int -> (forall d. Data d => d -> u) -> Ident -> u Source #

gmapM :: Monad m => (forall d. Data d => d -> m d) -> Ident -> m Ident Source #

gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> Ident -> m Ident Source #

gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> Ident -> m Ident Source #

Ord Ident Source # |
Instance details Defined in Text.Shakespeare.Base Methods compare :: Ident -> Ident -> Ordering Source # (<) :: Ident -> Ident -> Bool Source # (<=) :: Ident -> Ident -> Bool Source # (>) :: Ident -> Ident -> Bool Source # (>=) :: Ident -> Ident -> Bool Source # max :: Ident -> Ident -> Ident Source # min :: Ident -> Ident -> Ident Source #
Read Ident Source # |
Instance details Defined in Text.Shakespeare.Base Methods readsPrec :: Int -> ReadS Ident Source # readList :: ReadS [Ident] Source # readPrec :: ReadPrec Ident Source # readListPrec :: ReadPrec [Ident] Source #
Show Ident Source # |
Instance details Defined in Text.Shakespeare.Base Methods showsPrec :: Int -> Ident -> ShowS Source # show :: Ident -> String Source # showList :: [Ident] -> ShowS Source #
Lift Ident Source # |
Instance details Defined in Text.Shakespeare.Base Methods lift :: Ident -> Q Exp Source #

type Scope = [(Ident, Exp)] Source #

parseDeref :: UserParser a Deref Source #

parseHash :: UserParser a (Either String Deref) Source #

parseVar :: Char -> UserParser a (Either String Deref) Source #

parseVarString :: Char -> UserParser a (Either String String) Source #

parseAt :: UserParser a (Either String (Deref, Bool)) Source #

parseUrl :: Char -> Char -> UserParser a (Either String (Deref, Bool)) Source #

parseUrlString :: Char -> Char -> UserParser a (Either String String) Source #

parseCaret :: UserParser a (Either String Deref) Source #

parseUnder :: UserParser a (Either String Deref) Source #

parseInt :: Char -> UserParser a (Either String Deref) Source #

parseIntString :: Char -> UserParser a (Either String String) Source #

derefToExp :: Scope -> Deref -> Exp Source #

flattenDeref :: Deref -> Maybe [String] Source #

readUtf8File :: FilePath -> IO Text Source #

readUtf8FileString :: FilePath -> IO String Source #

Read file's content as `String`, converting newlines

Since: 2.0.19

readFileQ :: FilePath -> Q String Source #

Embed file's content, converting newlines

Since: 2.0.19

readFileRecompileQ :: FilePath -> Q String Source #

Embed file's content, converting newlines and track file via ghc dependencies, recompiling on changes

Since: 2.0.19