License | BSD-3-Clause |
---|---|
Maintainer | Jamie Willis |
Stability | experimental |
Safe Haskell | None |
Language | Haskell2010 |
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
- class MarshalOps o where
- dynHandler# :: StaHandler# s o a -> DynHandler s o a
- dynCont# :: StaCont# s o a x -> DynCont s o a x
- class RecBuilder o where
- bindIterHandler# :: (Code (Rep o) -> StaHandler# s o a) -> (Code (Rep o -> Handler# s o a) -> Code b) -> Code b
- bindIter# :: Code (Rep o) -> (DynHandler s o a -> Code (Rep o) -> Code (ST s (Maybe a))) -> Code (ST s (Maybe a))
- bindRec# :: (DynSubroutine s o a x -> DynCont s o a x -> Code (Rep o) -> DynHandler s o a -> Code (ST s (Maybe a))) -> DynSubroutine s o a x
- class JoinBuilder o where
- setupJoinPoint# :: StaCont# s o a x -> (DynCont s o a x -> Code b) -> Code b
- class HandlerOps o where
- bindHandler# :: StaHandler# s o a -> (DynHandler s o a -> Code b) -> Code b
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
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
class RecBuilder o where Source #
Various functions for creating bindings for recursive parsers.
Since: 1.4.0.0
:: (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
:: 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
:: (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
class JoinBuilder o where Source #
Generates join-point bindings.
Since: 1.4.0.0
:: 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
JoinBuilder ByteString Source # | |
Defined in Parsley.Internal.Backend.Machine.BindingOps setupJoinPoint# :: StaCont# s ByteString a x -> (DynCont s ByteString a x -> Code b) -> Code b Source # | |
JoinBuilder ByteString Source # | |
Defined in Parsley.Internal.Backend.Machine.BindingOps setupJoinPoint# :: StaCont# s ByteString a x -> (DynCont s ByteString a x -> Code b) -> Code b Source # | |
JoinBuilder Text Source # | |
Defined in Parsley.Internal.Backend.Machine.BindingOps | |
JoinBuilder Stream Source # | |
Defined in Parsley.Internal.Backend.Machine.BindingOps | |
JoinBuilder CharList Source # | |
Defined in Parsley.Internal.Backend.Machine.BindingOps | |
JoinBuilder Text16 Source # | |
Defined in Parsley.Internal.Backend.Machine.BindingOps | |
JoinBuilder [Char] Source # | |
Defined in Parsley.Internal.Backend.Machine.BindingOps | |
JoinBuilder (UArray Int Char) Source # | |
class HandlerOps o where Source #
Used to generate a binding for a handler.
Since: 1.4.0.0
:: 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