Safe Haskell | None |
---|---|
Language | Haskell98 |
Language.LBNF.Compiletime
Description
Contains things needed by BNFC-meta language definitions and by the code generated from those. Typical users don't need to browse this module.
Synopsis
- data HappyStk a = HappyStk a (HappyStk a)
- utf8Encode :: Char -> [Word8]
- data Posn = Pn !Int !Int !Int
- type AlexInput = (Posn, Char, [Word8], String)
- alexGetByte :: AlexInput -> Maybe (Word8, AlexInput)
- ord :: Char -> Int
- listArray :: Ix i => (i, i) -> [e] -> Array i e
- (!) :: Ix i => Array i e -> i -> e
- data Array i e
- printTree :: Print a => a -> String
- doc :: ShowS -> Doc
- concatD :: [Doc] -> Doc
- class Print a where
- prPrec :: Int -> Int -> Doc -> Doc
- newtype PrintPlain = MkPrintPlain String
- parseToQuoter :: (String -> ParseMonad BNFC_QQType) -> QuasiQuoter
- parseToMonQuoter :: (String -> ParseMonad BNFC_QQType) -> QuasiQuoter
- data ParseMonad a
- errq :: (String -> a) -> ParseMonad a -> Q a
- data Q a
- data BNFC_QQType
- appEPAll :: LocType -> String -> [BNFC_QQType] -> BNFC_QQType
- appEPAllL :: LocType -> [BNFC_QQType] -> BNFC_QQType
- fromString :: Literal a => LocType -> a -> BNFC_QQType
- fromLit :: Literal a => LocType -> a -> BNFC_QQType
- fromToken :: Literal a => LocType -> String -> a -> BNFC_QQType
- fromPositionToken :: LocType -> String -> ((Int, Int), String) -> BNFC_QQType
- class Lift (t :: TYPE r) where
- type LocType = (String, String)
- class Literal a where
- class IsChar a where
- printAq :: Print a => a -> BNFC_QQType
- stringAq :: String -> BNFC_QQType
Happy and Alex
utf8Encode :: Char -> [Word8] Source #
listArray :: Ix i => (i, i) -> [e] -> Array i e #
Construct an array from a pair of bounds and a list of values in index order.
The type of immutable non-strict (boxed) arrays
with indices in i
and elements in e
.
Instances
IArray Array e | |
Defined in Data.Array.Base Methods bounds :: Ix i => Array i e -> (i, i) # numElements :: Ix i => Array i e -> Int # unsafeArray :: Ix i => (i, i) -> [(Int, e)] -> Array i e # unsafeAt :: Ix i => Array i e -> Int -> e # unsafeReplace :: Ix i => Array i e -> [(Int, e)] -> Array i e # unsafeAccum :: Ix i => (e -> e' -> e) -> Array i e -> [(Int, e')] -> Array i e # unsafeAccumArray :: Ix i => (e -> e' -> e) -> e -> (i, i) -> [(Int, e')] -> Array i e # | |
Functor (Array i) | Since: base-2.1 |
Foldable (Array i) | Since: base-4.8.0.0 |
Defined in GHC.Internal.Data.Foldable Methods fold :: Monoid m => Array i m -> m # foldMap :: Monoid m => (a -> m) -> Array i a -> m # foldMap' :: Monoid m => (a -> m) -> Array i a -> m # foldr :: (a -> b -> b) -> b -> Array i a -> b # foldr' :: (a -> b -> b) -> b -> Array i a -> b # foldl :: (b -> a -> b) -> b -> Array i a -> b # foldl' :: (b -> a -> b) -> b -> Array i a -> b # foldr1 :: (a -> a -> a) -> Array i a -> a # foldl1 :: (a -> a -> a) -> Array i a -> a # elem :: Eq a => a -> Array i a -> Bool # maximum :: Ord a => Array i a -> a # minimum :: Ord a => Array i a -> a # | |
Ix i => Traversable (Array i) | Since: base-2.1 |
(Data a, Data b, Ix a) => Data (Array a b) | Since: base-4.8.0.0 |
Defined in GHC.Internal.Data.Data Methods gfoldl :: (forall d b0. Data d => c (d -> b0) -> d -> c b0) -> (forall g. g -> c g) -> Array a b -> c (Array a b) # gunfold :: (forall b0 r. Data b0 => c (b0 -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c (Array a b) # toConstr :: Array a b -> Constr # dataTypeOf :: Array a b -> DataType # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c (Array a b)) # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c (Array a b)) # gmapT :: (forall b0. Data b0 => b0 -> b0) -> Array a b -> Array a b # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Array a b -> r # gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Array a b -> r # gmapQ :: (forall d. Data d => d -> u) -> Array a b -> [u] # gmapQi :: Int -> (forall d. Data d => d -> u) -> Array a b -> u # gmapM :: Monad m => (forall d. Data d => d -> m d) -> Array a b -> m (Array a b) # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> Array a b -> m (Array a b) # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> Array a b -> m (Array a b) # | |
(Ix a, Read a, Read b) => Read (Array a b) | Since: base-2.1 |
(Ix a, Show a, Show b) => Show (Array a b) | Since: base-2.1 |
(Ix i, Eq e) => Eq (Array i e) | Since: base-2.1 |
(Ix i, Ord e) => Ord (Array i e) | Since: base-2.1 |
Pretty printing
Minimal complete definition
Instances
Print Arg Source # | |
Print Cat Source # | |
Print Def Source # | |
Print Exp Source # | |
Print Grammar Source # | |
Print HsTyp Source # | |
Print Ident Source # | |
Print Item Source # | |
Print Label Source # | |
Print MIdent Source # | |
Print MinimumSize Source # | |
Defined in Language.LBNF.Grammar | |
Print RHS Source # | |
Print Reg Source # | |
Print PrintPlain Source # | |
Defined in Language.LBNF.Runtime | |
Print Integer Source # | |
Print Char Source # | |
Print Double Source # | |
Print a => Print [a] Source # | |
newtype PrintPlain Source #
Constructors
MkPrintPlain String |
Instances
Print PrintPlain Source # | |
Defined in Language.LBNF.Runtime |
Quasi quoting
parseToQuoter :: (String -> ParseMonad BNFC_QQType) -> QuasiQuoter Source #
parseToMonQuoter :: (String -> ParseMonad BNFC_QQType) -> QuasiQuoter Source #
data ParseMonad a Source #
Instances
Instances
data BNFC_QQType Source #
appEPAll :: LocType -> String -> [BNFC_QQType] -> BNFC_QQType Source #
appEPAllL :: LocType -> [BNFC_QQType] -> BNFC_QQType Source #
fromString :: Literal a => LocType -> a -> BNFC_QQType Source #
fromPositionToken :: LocType -> String -> ((Int, Int), String) -> BNFC_QQType Source #
class Lift (t :: TYPE r) where #
A Lift
instance can have any of its values turned into a Template
Haskell expression. This is needed when a value used within a Template
Haskell quotation is bound outside the Oxford brackets ([| ... |]
or
[|| ... ||]
) but not at the top level. As an example:
add1 :: Int -> Code Q Int add1 x = [|| x + 1 ||]
Template Haskell has no way of knowing what value x
will take on at
splice-time, so it requires the type of x
to be an instance of Lift
.
A Lift
instance must satisfy $(lift x) ≡ x
and $$(liftTyped x) ≡ x
for all x
, where $(...)
and $$(...)
are Template Haskell splices.
It is additionally expected that
.lift
x ≡ unTypeCode
(liftTyped
x)
Lift
instances can be derived automatically by use of the -XDeriveLift
GHC language extension:
{-# LANGUAGE DeriveLift #-} module Foo where import Language.Haskell.TH.Syntax data Bar a = Bar1 a (Bar a) | Bar2 String deriving Lift
Representation-polymorphic since template-haskell-2.16.0.0.
Minimal complete definition
Methods
lift :: Quote m => t -> m Exp #
Turn a value into a Template Haskell expression, suitable for use in a splice.
liftTyped :: forall (m :: Type -> Type). Quote m => t -> Code m t #
Turn a value into a Template Haskell typed expression, suitable for use in a typed splice.
Since: template-haskell-2.16.0.0
Instances
Lift Addr# | Produces an Since: template-haskell-2.16.0.0 |
Lift Double# | Since: template-haskell-2.16.0.0 |
Lift Float# | Since: template-haskell-2.16.0.0 |
Lift Int# | Since: template-haskell-2.16.0.0 |
Lift ByteArray | Since: template-haskell-2.19.0.0 |
Lift Void | Since: template-haskell-2.15.0.0 |
Lift Int16 | |
Lift Int32 | |
Lift Int64 | |
Lift Int8 | |
Lift Word16 | |
Lift Word32 | |
Lift Word64 | |
Lift Word8 | |
Lift Integer | |
Lift Natural | |
Lift () | |
Lift Bool | |
Lift Char | |
Lift Double | |
Lift Float | |
Lift Int | |
Lift Word | |
Lift Char# | Since: template-haskell-2.16.0.0 |
Lift Word# | Since: template-haskell-2.16.0.0 |
Lift (# #) | Since: template-haskell-2.16.0.0 |
Lift a => Lift (NonEmpty a :: Type) | Since: template-haskell-2.15.0.0 |
Integral a => Lift (Ratio a :: Type) | |
Lift a => Lift (Maybe a :: Type) | |
Lift a => Lift ([a] :: Type) | |
Lift (Fixed a :: Type) | |
(Lift a, Lift b) => Lift (Either a b :: Type) | |
(Lift a, Lift b) => Lift ((a, b) :: Type) | |
(Lift a, Lift b, Lift c) => Lift ((a, b, c) :: Type) | |
(Lift a, Lift b, Lift c, Lift d) => Lift ((a, b, c, d) :: Type) | |
(Lift a, Lift b, Lift c, Lift d, Lift e) => Lift ((a, b, c, d, e) :: Type) | |
(Lift a, Lift b, Lift c, Lift d, Lift e, Lift f) => Lift ((a, b, c, d, e, f) :: Type) | |
(Lift a, Lift b, Lift c, Lift d, Lift e, Lift f, Lift g) => Lift ((a, b, c, d, e, f, g) :: Type) | |
Lift a => Lift ((# a #) :: TYPE ('TupleRep '[LiftedRep])) | Since: template-haskell-2.16.0.0 |
(Lift a, Lift b) => Lift ((# a | b #) :: TYPE ('SumRep '[LiftedRep, LiftedRep])) | Since: template-haskell-2.16.0.0 |
(Lift a, Lift b) => Lift ((# a, b #) :: TYPE ('TupleRep '[LiftedRep, LiftedRep])) | Since: template-haskell-2.16.0.0 |
(Lift a, Lift b, Lift c) => Lift ((# a | b | c #) :: TYPE ('SumRep '[LiftedRep, LiftedRep, LiftedRep])) | Since: template-haskell-2.16.0.0 |
(Lift a, Lift b, Lift c) => Lift ((# a, b, c #) :: TYPE ('TupleRep '[LiftedRep, LiftedRep, LiftedRep])) | Since: template-haskell-2.16.0.0 |
(Lift a, Lift b, Lift c, Lift d) => Lift ((# a | b | c | d #) :: TYPE ('SumRep '[LiftedRep, LiftedRep, LiftedRep, LiftedRep])) | Since: template-haskell-2.16.0.0 |
(Lift a, Lift b, Lift c, Lift d) => Lift ((# a, b, c, d #) :: TYPE ('TupleRep '[LiftedRep, LiftedRep, LiftedRep, LiftedRep])) | Since: template-haskell-2.16.0.0 |
(Lift a, Lift b, Lift c, Lift d, Lift e) => Lift ((# a | b | c | d | e #) :: TYPE ('SumRep '[LiftedRep, LiftedRep, LiftedRep, LiftedRep, LiftedRep])) | Since: template-haskell-2.16.0.0 |
(Lift a, Lift b, Lift c, Lift d, Lift e) => Lift ((# a, b, c, d, e #) :: TYPE ('TupleRep '[LiftedRep, LiftedRep, LiftedRep, LiftedRep, LiftedRep])) | Since: template-haskell-2.16.0.0 |
(Lift a, Lift b, Lift c, Lift d, Lift e, Lift f) => Lift ((# a | b | c | d | e | f #) :: TYPE ('SumRep '[LiftedRep, LiftedRep, LiftedRep, LiftedRep, LiftedRep, LiftedRep])) | Since: template-haskell-2.16.0.0 |
(Lift a, Lift b, Lift c, Lift d, Lift e, Lift f) => Lift ((# a, b, c, d, e, f #) :: TYPE ('TupleRep '[LiftedRep, LiftedRep, LiftedRep, LiftedRep, LiftedRep, LiftedRep])) | Since: template-haskell-2.16.0.0 |
(Lift a, Lift b, Lift c, Lift d, Lift e, Lift f, Lift g) => Lift ((# a | b | c | d | e | f | g #) :: TYPE ('SumRep '[LiftedRep, LiftedRep, LiftedRep, LiftedRep, LiftedRep, LiftedRep, LiftedRep])) | Since: template-haskell-2.16.0.0 |
(Lift a, Lift b, Lift c, Lift d, Lift e, Lift f, Lift g) => Lift ((# a, b, c, d, e, f, g #) :: TYPE ('TupleRep '[LiftedRep, LiftedRep, LiftedRep, LiftedRep, LiftedRep, LiftedRep, LiftedRep])) | Since: template-haskell-2.16.0.0 |
Helper functions for defining Anti-quotation
printAq :: Print a => a -> BNFC_QQType Source #
stringAq :: String -> BNFC_QQType Source #