parsley-core-1.6.0.0: A fast parser combinator library backed by Typed Template Haskell
LicenseBSD-3-Clause
MaintainerJamie Willis
Stabilityexperimental
Safe HaskellNone
LanguageHaskell2010

Parsley.Internal.Backend.Machine.BindingOps

Description

This module contains the parts of the code-base that deal with levity-polymorphic code.

For performance, and to help GHC optimise, parsley takes an aggressive stance with unboxing and representing input using unlifted types. This means that the code generator is levity polymorphic. While the generated code itself is not polymorphic, to respect the soundness of GHC, any code that is generated which explicitly creates an unlifted value is kept in type-class methods and instantiated for every input type. All of these classes are found here.

Since: 1.4.0.0

Synopsis

Documentation

class MarshalOps o where Source #

These operations are responsible for materialising the static handlers and continuations into dynamic forms that can be passed into other bindings at runtime.

Since: 1.4.0.0

Methods

dynHandler# :: StaHandler# s o a -> DynHandler s o a Source #

Converts a static handler into a dynamic one (represented as a lambda)

Since: 1.4.0.0

dynCont# :: StaCont# s o a x -> DynCont s o a x Source #

Converts a static continuation into a dynamic one (represented as a lambda)

Since: 1.4.0.0

Instances

Instances details
MarshalOps ByteString Source # 
Instance details

Defined in Parsley.Internal.Backend.Machine.BindingOps

MarshalOps ByteString Source # 
Instance details

Defined in Parsley.Internal.Backend.Machine.BindingOps

MarshalOps Text Source # 
Instance details

Defined in Parsley.Internal.Backend.Machine.BindingOps

MarshalOps Stream Source # 
Instance details

Defined in Parsley.Internal.Backend.Machine.BindingOps

MarshalOps CharList Source # 
Instance details

Defined in Parsley.Internal.Backend.Machine.BindingOps

MarshalOps Text16 Source # 
Instance details

Defined in Parsley.Internal.Backend.Machine.BindingOps

MarshalOps [Char] Source # 
Instance details

Defined in Parsley.Internal.Backend.Machine.BindingOps

Methods

dynHandler# :: StaHandler# s [Char] a -> DynHandler s [Char] a Source #

dynCont# :: StaCont# s [Char] a x -> DynCont s [Char] a x Source #

MarshalOps (UArray Int Char) Source # 
Instance details

Defined in Parsley.Internal.Backend.Machine.BindingOps

class RecBuilder o where Source #

Various functions for creating bindings for recursive parsers.

Since: 1.4.0.0

Methods

bindIterHandler# Source #

Arguments

:: (Code (Rep o) -> StaHandler# s o a)

The iter handler to bind

-> (Code (Rep o -> Handler# s o a) -> Code b)

The continuation that accepts the bound handler

-> Code b 

Create a binder for specialist iterating handlers: these have two arguments, one for the current captured offset and then the second for the offset at point of failure.

Since: 1.4.0.0

bindIter# Source #

Arguments

:: Code (Rep o)

Initial offset for the loop.

-> (DynHandler s o a -> Code (Rep o) -> Code (ST s (Maybe a)))

The code for the loop given handler and offset.

-> Code (ST s (Maybe a))

Code of the executing loop.

Creates a binding for a tail-recursive loop.

Since: 1.4.0.0

bindRec# Source #

Arguments

:: (DynSubroutine s o a x -> DynCont s o a x -> Code (Rep o) -> DynHandler s o a -> Code (ST s (Maybe a)))

Code for the binding, accepting itself as an argument.

-> DynSubroutine s o a x

The code that represents this binding's name.

Creates a binding for a regular let-bound parser.

Since: 1.4.0.0

Instances

Instances details
RecBuilder ByteString Source # 
Instance details

Defined in Parsley.Internal.Backend.Machine.BindingOps

RecBuilder ByteString Source # 
Instance details

Defined in Parsley.Internal.Backend.Machine.BindingOps

RecBuilder Text Source # 
Instance details

Defined in Parsley.Internal.Backend.Machine.BindingOps

Methods

bindIterHandler# :: (Code (Rep Text) -> StaHandler# s Text a) -> (Code (Rep Text -> Handler# s Text a) -> Code b) -> Code b Source #

bindIter# :: Code (Rep Text) -> (DynHandler s Text a -> Code (Rep Text) -> Code (ST s (Maybe a))) -> Code (ST s (Maybe a)) Source #

bindRec# :: (DynSubroutine s Text a x -> DynCont s Text a x -> Code (Rep Text) -> DynHandler s Text a -> Code (ST s (Maybe a))) -> DynSubroutine s Text a x Source #

RecBuilder Stream Source # 
Instance details

Defined in Parsley.Internal.Backend.Machine.BindingOps

Methods

bindIterHandler# :: (Code (Rep Stream) -> StaHandler# s Stream a) -> (Code (Rep Stream -> Handler# s Stream a) -> Code b) -> Code b Source #

bindIter# :: Code (Rep Stream) -> (DynHandler s Stream a -> Code (Rep Stream) -> Code (ST s (Maybe a))) -> Code (ST s (Maybe a)) Source #

bindRec# :: (DynSubroutine s Stream a x -> DynCont s Stream a x -> Code (Rep Stream) -> DynHandler s Stream a -> Code (ST s (Maybe a))) -> DynSubroutine s Stream a x Source #

RecBuilder CharList Source # 
Instance details

Defined in Parsley.Internal.Backend.Machine.BindingOps

RecBuilder Text16 Source # 
Instance details

Defined in Parsley.Internal.Backend.Machine.BindingOps

Methods

bindIterHandler# :: (Code (Rep Text16) -> StaHandler# s Text16 a) -> (Code (Rep Text16 -> Handler# s Text16 a) -> Code b) -> Code b Source #

bindIter# :: Code (Rep Text16) -> (DynHandler s Text16 a -> Code (Rep Text16) -> Code (ST s (Maybe a))) -> Code (ST s (Maybe a)) Source #

bindRec# :: (DynSubroutine s Text16 a x -> DynCont s Text16 a x -> Code (Rep Text16) -> DynHandler s Text16 a -> Code (ST s (Maybe a))) -> DynSubroutine s Text16 a x Source #

RecBuilder [Char] Source # 
Instance details

Defined in Parsley.Internal.Backend.Machine.BindingOps

Methods

bindIterHandler# :: (Code (Rep [Char]) -> StaHandler# s [Char] a) -> (Code (Rep [Char] -> Handler# s [Char] a) -> Code b) -> Code b Source #

bindIter# :: Code (Rep [Char]) -> (DynHandler s [Char] a -> Code (Rep [Char]) -> Code (ST s (Maybe a))) -> Code (ST s (Maybe a)) Source #

bindRec# :: (DynSubroutine s [Char] a x -> DynCont s [Char] a x -> Code (Rep [Char]) -> DynHandler s [Char] a -> Code (ST s (Maybe a))) -> DynSubroutine s [Char] a x Source #

RecBuilder (UArray Int Char) Source # 
Instance details

Defined in Parsley.Internal.Backend.Machine.BindingOps

class JoinBuilder o where Source #

Generates join-point bindings.

Since: 1.4.0.0

Methods

setupJoinPoint# Source #

Arguments

:: StaCont# s o a x

The join point to bind.

-> (DynCont s o a x -> Code b)

The continuation that expects the bound join point

-> Code b 

Generate a let-bound join point and provide it to another continuation.

Since: 1.4.0.0

Instances

Instances details
JoinBuilder ByteString Source # 
Instance details

Defined in Parsley.Internal.Backend.Machine.BindingOps

Methods

setupJoinPoint# :: StaCont# s ByteString a x -> (DynCont s ByteString a x -> Code b) -> Code b Source #

JoinBuilder ByteString Source # 
Instance details

Defined in Parsley.Internal.Backend.Machine.BindingOps

Methods

setupJoinPoint# :: StaCont# s ByteString a x -> (DynCont s ByteString a x -> Code b) -> Code b Source #

JoinBuilder Text Source # 
Instance details

Defined in Parsley.Internal.Backend.Machine.BindingOps

Methods

setupJoinPoint# :: StaCont# s Text a x -> (DynCont s Text a x -> Code b) -> Code b Source #

JoinBuilder Stream Source # 
Instance details

Defined in Parsley.Internal.Backend.Machine.BindingOps

Methods

setupJoinPoint# :: StaCont# s Stream a x -> (DynCont s Stream a x -> Code b) -> Code b Source #

JoinBuilder CharList Source # 
Instance details

Defined in Parsley.Internal.Backend.Machine.BindingOps

Methods

setupJoinPoint# :: StaCont# s CharList a x -> (DynCont s CharList a x -> Code b) -> Code b Source #

JoinBuilder Text16 Source # 
Instance details

Defined in Parsley.Internal.Backend.Machine.BindingOps

Methods

setupJoinPoint# :: StaCont# s Text16 a x -> (DynCont s Text16 a x -> Code b) -> Code b Source #

JoinBuilder [Char] Source # 
Instance details

Defined in Parsley.Internal.Backend.Machine.BindingOps

Methods

setupJoinPoint# :: StaCont# s [Char] a x -> (DynCont s [Char] a x -> Code b) -> Code b Source #

JoinBuilder (UArray Int Char) Source # 
Instance details

Defined in Parsley.Internal.Backend.Machine.BindingOps

Methods

setupJoinPoint# :: StaCont# s (UArray Int Char) a x -> (DynCont s (UArray Int Char) a x -> Code b) -> Code b Source #

class HandlerOps o where Source #

Used to generate a binding for a handler.

Since: 1.4.0.0

Methods

bindHandler# Source #

Arguments

:: StaHandler# s o a

Static handler to bind

-> (DynHandler s o a -> Code b)

The continuation that expects the bound handler

-> Code b 

Generate a let-bound handler and provide it to another continuation.

Since: 1.4.0.0

Instances

Instances details
HandlerOps ByteString Source # 
Instance details

Defined in Parsley.Internal.Backend.Machine.BindingOps

HandlerOps ByteString Source # 
Instance details

Defined in Parsley.Internal.Backend.Machine.BindingOps

HandlerOps Text Source # 
Instance details

Defined in Parsley.Internal.Backend.Machine.BindingOps

Methods

bindHandler# :: StaHandler# s Text a -> (DynHandler s Text a -> Code b) -> Code b Source #

HandlerOps Stream Source # 
Instance details

Defined in Parsley.Internal.Backend.Machine.BindingOps

Methods

bindHandler# :: StaHandler# s Stream a -> (DynHandler s Stream a -> Code b) -> Code b Source #

HandlerOps CharList Source # 
Instance details

Defined in Parsley.Internal.Backend.Machine.BindingOps

HandlerOps Text16 Source # 
Instance details

Defined in Parsley.Internal.Backend.Machine.BindingOps

Methods

bindHandler# :: StaHandler# s Text16 a -> (DynHandler s Text16 a -> Code b) -> Code b Source #

HandlerOps [Char] Source # 
Instance details

Defined in Parsley.Internal.Backend.Machine.BindingOps

Methods

bindHandler# :: StaHandler# s [Char] a -> (DynHandler s [Char] a -> Code b) -> Code b Source #

HandlerOps (UArray Int Char) Source # 
Instance details

Defined in Parsley.Internal.Backend.Machine.BindingOps