{-# language CPP #-}
{-# language FlexibleContexts #-}
{-# language FlexibleInstances #-}
{-# language FunctionalDependencies #-}
{-# language MultiParamTypeClasses #-}
{-# language UndecidableInstances #-}
module Text.Trifecta.Combinators
( DeltaParsing(..)
, sliced
, careting, careted
, spanning, spanned
, fixiting
, MarkParsing(..)
) where
import Control.Applicative
import Control.Monad (MonadPlus)
import Control.Monad.Trans.Class
import Control.Monad.Trans.Identity
import Control.Monad.Trans.Reader
import Control.Monad.Trans.RWS.Lazy as Lazy
import Control.Monad.Trans.RWS.Strict as Strict
import Control.Monad.Trans.State.Lazy as Lazy
import Control.Monad.Trans.State.Strict as Strict
import Control.Monad.Trans.Writer.Lazy as Lazy
import Control.Monad.Trans.Writer.Strict as Strict
import Data.ByteString as Strict hiding (span)
#if !(MIN_VERSION_base(4,11,0))
import Data.Semigroup
#endif
import Prelude hiding (span)
import Text.Parser.Token
import Text.Trifecta.Delta
import Text.Trifecta.Rendering
class (MonadPlus m, TokenParsing m) => DeltaParsing m where
line :: m ByteString
position :: m Delta
slicedWith :: (a -> Strict.ByteString -> r) -> m a -> m r
rend :: m Rendering
rend = forall s. Source s => Delta -> s -> Rendering
rendered forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> forall (m :: * -> *). DeltaParsing m => m Delta
position forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> forall (m :: * -> *). DeltaParsing m => m ByteString
line
{-# inlinable rend #-}
restOfLine :: m ByteString
restOfLine = Int -> ByteString -> ByteString
Strict.drop forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall a b. (Integral a, Num b) => a -> b
fromIntegral forall b c a. (b -> c) -> (a -> b) -> a -> c
. Delta -> Int64
columnByte forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> forall (m :: * -> *). DeltaParsing m => m Delta
position forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> forall (m :: * -> *). DeltaParsing m => m ByteString
line
{-# inlinable restOfLine #-}
instance (MonadPlus m, DeltaParsing m) => DeltaParsing (Lazy.StateT s m) where
line :: StateT s m ByteString
line = forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall (m :: * -> *). DeltaParsing m => m ByteString
line
{-# inlinable line #-}
position :: StateT s m Delta
position = forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall (m :: * -> *). DeltaParsing m => m Delta
position
{-# inlinable position #-}
slicedWith :: forall a r. (a -> ByteString -> r) -> StateT s m a -> StateT s m r
slicedWith a -> ByteString -> r
f (Lazy.StateT s -> m (a, s)
m) = forall s (m :: * -> *) a. (s -> m (a, s)) -> StateT s m a
Lazy.StateT forall a b. (a -> b) -> a -> b
$ \s
s -> forall (m :: * -> *) a r.
DeltaParsing m =>
(a -> ByteString -> r) -> m a -> m r
slicedWith (\(a
a,s
s') ByteString
b -> (a -> ByteString -> r
f a
a ByteString
b, s
s')) forall a b. (a -> b) -> a -> b
$ s -> m (a, s)
m s
s
{-# inlinable slicedWith #-}
rend :: StateT s m Rendering
rend = forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall (m :: * -> *). DeltaParsing m => m Rendering
rend
{-# inlinable rend #-}
restOfLine :: StateT s m ByteString
restOfLine = forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall (m :: * -> *). DeltaParsing m => m ByteString
restOfLine
{-# inlinable restOfLine #-}
instance (MonadPlus m, DeltaParsing m) => DeltaParsing (Strict.StateT s m) where
line :: StateT s m ByteString
line = forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall (m :: * -> *). DeltaParsing m => m ByteString
line
{-# inlinable line #-}
position :: StateT s m Delta
position = forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall (m :: * -> *). DeltaParsing m => m Delta
position
{-# inlinable position #-}
slicedWith :: forall a r. (a -> ByteString -> r) -> StateT s m a -> StateT s m r
slicedWith a -> ByteString -> r
f (Strict.StateT s -> m (a, s)
m) = forall s (m :: * -> *) a. (s -> m (a, s)) -> StateT s m a
Strict.StateT forall a b. (a -> b) -> a -> b
$ \s
s -> forall (m :: * -> *) a r.
DeltaParsing m =>
(a -> ByteString -> r) -> m a -> m r
slicedWith (\(a
a,s
s') ByteString
b -> (a -> ByteString -> r
f a
a ByteString
b, s
s')) forall a b. (a -> b) -> a -> b
$ s -> m (a, s)
m s
s
{-# inlinable slicedWith #-}
rend :: StateT s m Rendering
rend = forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall (m :: * -> *). DeltaParsing m => m Rendering
rend
{-# inlinable rend #-}
restOfLine :: StateT s m ByteString
restOfLine = forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall (m :: * -> *). DeltaParsing m => m ByteString
restOfLine
{-# inlinable restOfLine #-}
instance (MonadPlus m, DeltaParsing m) => DeltaParsing (ReaderT e m) where
line :: ReaderT e m ByteString
line = forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall (m :: * -> *). DeltaParsing m => m ByteString
line
{-# inlinable line #-}
position :: ReaderT e m Delta
position = forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall (m :: * -> *). DeltaParsing m => m Delta
position
{-# inlinable position #-}
slicedWith :: forall a r.
(a -> ByteString -> r) -> ReaderT e m a -> ReaderT e m r
slicedWith a -> ByteString -> r
f (ReaderT e -> m a
m) = forall r (m :: * -> *) a. (r -> m a) -> ReaderT r m a
ReaderT forall a b. (a -> b) -> a -> b
$ forall (m :: * -> *) a r.
DeltaParsing m =>
(a -> ByteString -> r) -> m a -> m r
slicedWith a -> ByteString -> r
f forall b c a. (b -> c) -> (a -> b) -> a -> c
. e -> m a
m
{-# inlinable slicedWith #-}
rend :: ReaderT e m Rendering
rend = forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall (m :: * -> *). DeltaParsing m => m Rendering
rend
{-# inlinable rend #-}
restOfLine :: ReaderT e m ByteString
restOfLine = forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall (m :: * -> *). DeltaParsing m => m ByteString
restOfLine
{-# inlinable restOfLine #-}
instance (MonadPlus m, DeltaParsing m, Monoid w) => DeltaParsing (Strict.WriterT w m) where
line :: WriterT w m ByteString
line = forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall (m :: * -> *). DeltaParsing m => m ByteString
line
{-# inlinable line #-}
position :: WriterT w m Delta
position = forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall (m :: * -> *). DeltaParsing m => m Delta
position
{-# inlinable position #-}
slicedWith :: forall a r.
(a -> ByteString -> r) -> WriterT w m a -> WriterT w m r
slicedWith a -> ByteString -> r
f (Strict.WriterT m (a, w)
m) = forall w (m :: * -> *) a. m (a, w) -> WriterT w m a
Strict.WriterT forall a b. (a -> b) -> a -> b
$ forall (m :: * -> *) a r.
DeltaParsing m =>
(a -> ByteString -> r) -> m a -> m r
slicedWith (\(a
a,w
s') ByteString
b -> (a -> ByteString -> r
f a
a ByteString
b, w
s')) m (a, w)
m
{-# inlinable slicedWith #-}
rend :: WriterT w m Rendering
rend = forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall (m :: * -> *). DeltaParsing m => m Rendering
rend
{-# inlinable rend #-}
restOfLine :: WriterT w m ByteString
restOfLine = forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall (m :: * -> *). DeltaParsing m => m ByteString
restOfLine
{-# inlinable restOfLine #-}
instance (MonadPlus m, DeltaParsing m, Monoid w) => DeltaParsing (Lazy.WriterT w m) where
line :: WriterT w m ByteString
line = forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall (m :: * -> *). DeltaParsing m => m ByteString
line
{-# inlinable line #-}
position :: WriterT w m Delta
position = forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall (m :: * -> *). DeltaParsing m => m Delta
position
{-# inlinable position #-}
slicedWith :: forall a r.
(a -> ByteString -> r) -> WriterT w m a -> WriterT w m r
slicedWith a -> ByteString -> r
f (Lazy.WriterT m (a, w)
m) = forall w (m :: * -> *) a. m (a, w) -> WriterT w m a
Lazy.WriterT forall a b. (a -> b) -> a -> b
$ forall (m :: * -> *) a r.
DeltaParsing m =>
(a -> ByteString -> r) -> m a -> m r
slicedWith (\(a
a,w
s') ByteString
b -> (a -> ByteString -> r
f a
a ByteString
b, w
s')) m (a, w)
m
{-# inlinable slicedWith #-}
rend :: WriterT w m Rendering
rend = forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall (m :: * -> *). DeltaParsing m => m Rendering
rend
{-# inlinable rend #-}
restOfLine :: WriterT w m ByteString
restOfLine = forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall (m :: * -> *). DeltaParsing m => m ByteString
restOfLine
{-# inlinable restOfLine #-}
instance (MonadPlus m, DeltaParsing m, Monoid w) => DeltaParsing (Lazy.RWST r w s m) where
line :: RWST r w s m ByteString
line = forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall (m :: * -> *). DeltaParsing m => m ByteString
line
{-# inlinable line #-}
position :: RWST r w s m Delta
position = forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall (m :: * -> *). DeltaParsing m => m Delta
position
{-# inlinable position #-}
slicedWith :: forall a r.
(a -> ByteString -> r) -> RWST r w s m a -> RWST r w s m r
slicedWith a -> ByteString -> r
f (Lazy.RWST r -> s -> m (a, s, w)
m) = forall r w s (m :: * -> *) a.
(r -> s -> m (a, s, w)) -> RWST r w s m a
Lazy.RWST forall a b. (a -> b) -> a -> b
$ \r
r s
s -> forall (m :: * -> *) a r.
DeltaParsing m =>
(a -> ByteString -> r) -> m a -> m r
slicedWith (\(a
a,s
s',w
w) ByteString
b -> (a -> ByteString -> r
f a
a ByteString
b, s
s',w
w)) forall a b. (a -> b) -> a -> b
$ r -> s -> m (a, s, w)
m r
r s
s
{-# inlinable slicedWith #-}
rend :: RWST r w s m Rendering
rend = forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall (m :: * -> *). DeltaParsing m => m Rendering
rend
{-# inlinable rend #-}
restOfLine :: RWST r w s m ByteString
restOfLine = forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall (m :: * -> *). DeltaParsing m => m ByteString
restOfLine
{-# inlinable restOfLine #-}
instance (MonadPlus m, DeltaParsing m, Monoid w) => DeltaParsing (Strict.RWST r w s m) where
line :: RWST r w s m ByteString
line = forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall (m :: * -> *). DeltaParsing m => m ByteString
line
{-# inlinable line #-}
position :: RWST r w s m Delta
position = forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall (m :: * -> *). DeltaParsing m => m Delta
position
{-# inlinable position #-}
slicedWith :: forall a r.
(a -> ByteString -> r) -> RWST r w s m a -> RWST r w s m r
slicedWith a -> ByteString -> r
f (Strict.RWST r -> s -> m (a, s, w)
m) = forall r w s (m :: * -> *) a.
(r -> s -> m (a, s, w)) -> RWST r w s m a
Strict.RWST forall a b. (a -> b) -> a -> b
$ \r
r s
s -> forall (m :: * -> *) a r.
DeltaParsing m =>
(a -> ByteString -> r) -> m a -> m r
slicedWith (\(a
a,s
s',w
w) ByteString
b -> (a -> ByteString -> r
f a
a ByteString
b, s
s',w
w)) forall a b. (a -> b) -> a -> b
$ r -> s -> m (a, s, w)
m r
r s
s
{-# inlinable slicedWith #-}
rend :: RWST r w s m Rendering
rend = forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall (m :: * -> *). DeltaParsing m => m Rendering
rend
{-# inlinable rend #-}
restOfLine :: RWST r w s m ByteString
restOfLine = forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall (m :: * -> *). DeltaParsing m => m ByteString
restOfLine
{-# inlinable restOfLine #-}
instance (MonadPlus m, DeltaParsing m) => DeltaParsing (IdentityT m) where
line :: IdentityT m ByteString
line = forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall (m :: * -> *). DeltaParsing m => m ByteString
line
{-# inlinable line #-}
position :: IdentityT m Delta
position = forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall (m :: * -> *). DeltaParsing m => m Delta
position
{-# inlinable position #-}
slicedWith :: forall a r.
(a -> ByteString -> r) -> IdentityT m a -> IdentityT m r
slicedWith a -> ByteString -> r
f (IdentityT m a
m) = forall {k} (f :: k -> *) (a :: k). f a -> IdentityT f a
IdentityT forall a b. (a -> b) -> a -> b
$ forall (m :: * -> *) a r.
DeltaParsing m =>
(a -> ByteString -> r) -> m a -> m r
slicedWith a -> ByteString -> r
f m a
m
{-# inlinable slicedWith #-}
rend :: IdentityT m Rendering
rend = forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall (m :: * -> *). DeltaParsing m => m Rendering
rend
{-# inlinable rend #-}
restOfLine :: IdentityT m ByteString
restOfLine = forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall (m :: * -> *). DeltaParsing m => m ByteString
restOfLine
{-# inlinable restOfLine #-}
sliced :: DeltaParsing m => m a -> m ByteString
sliced :: forall (m :: * -> *) a. DeltaParsing m => m a -> m ByteString
sliced = forall (m :: * -> *) a r.
DeltaParsing m =>
(a -> ByteString -> r) -> m a -> m r
slicedWith (\a
_ ByteString
bs -> ByteString
bs)
{-# inlinable sliced #-}
careting :: DeltaParsing m => m Caret
careting :: forall (m :: * -> *). DeltaParsing m => m Caret
careting = Delta -> ByteString -> Caret
Caret forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> forall (m :: * -> *). DeltaParsing m => m Delta
position forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> forall (m :: * -> *). DeltaParsing m => m ByteString
line
{-# inlinable careting #-}
careted :: DeltaParsing m => m a -> m (Careted a)
careted :: forall (m :: * -> *) a. DeltaParsing m => m a -> m (Careted a)
careted m a
p = (\Delta
m ByteString
l a
a -> a
a forall a. a -> Caret -> Careted a
:^ Delta -> ByteString -> Caret
Caret Delta
m ByteString
l) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> forall (m :: * -> *). DeltaParsing m => m Delta
position forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> forall (m :: * -> *). DeltaParsing m => m ByteString
line forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> m a
p
{-# inlinable careted #-}
spanning :: DeltaParsing m => m a -> m Span
spanning :: forall (m :: * -> *) a. DeltaParsing m => m a -> m Span
spanning m a
p = (\Delta
s ByteString
l Delta
e -> Delta -> Delta -> ByteString -> Span
Span Delta
s Delta
e ByteString
l) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> forall (m :: * -> *). DeltaParsing m => m Delta
position forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> forall (m :: * -> *). DeltaParsing m => m ByteString
line forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> (m a
p forall (f :: * -> *) a b. Applicative f => f a -> f b -> f b
*> forall (m :: * -> *). DeltaParsing m => m Delta
position)
{-# inlinable spanning #-}
spanned :: DeltaParsing m => m a -> m (Spanned a)
spanned :: forall (m :: * -> *) a. DeltaParsing m => m a -> m (Spanned a)
spanned m a
p = (\Delta
s ByteString
l a
a Delta
e -> a
a forall a. a -> Span -> Spanned a
:~ Delta -> Delta -> ByteString -> Span
Span Delta
s Delta
e ByteString
l) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> forall (m :: * -> *). DeltaParsing m => m Delta
position forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> forall (m :: * -> *). DeltaParsing m => m ByteString
line forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> m a
p forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> forall (m :: * -> *). DeltaParsing m => m Delta
position
{-# inlinable spanned #-}
fixiting :: DeltaParsing m => m Strict.ByteString -> m Fixit
fixiting :: forall (m :: * -> *). DeltaParsing m => m ByteString -> m Fixit
fixiting m ByteString
p = (\(ByteString
r :~ Span
s) -> Span -> ByteString -> Fixit
Fixit Span
s ByteString
r) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> forall (m :: * -> *) a. DeltaParsing m => m a -> m (Spanned a)
spanned m ByteString
p
{-# inlinable fixiting #-}
class (DeltaParsing m, HasDelta d) => MarkParsing d m | m -> d where
mark :: m d
release :: d -> m ()
instance (MonadPlus m, MarkParsing d m) => MarkParsing d (Lazy.StateT s m) where
mark :: StateT s m d
mark = forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall d (m :: * -> *). MarkParsing d m => m d
mark
{-# inlinable mark #-}
release :: d -> StateT s m ()
release = forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall d (m :: * -> *). MarkParsing d m => d -> m ()
release
{-# inlinable release #-}
instance (MonadPlus m, MarkParsing d m) => MarkParsing d (Strict.StateT s m) where
mark :: StateT s m d
mark = forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall d (m :: * -> *). MarkParsing d m => m d
mark
{-# inlinable mark #-}
release :: d -> StateT s m ()
release = forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall d (m :: * -> *). MarkParsing d m => d -> m ()
release
{-# inlinable release #-}
instance (MonadPlus m, MarkParsing d m) => MarkParsing d (ReaderT e m) where
mark :: ReaderT e m d
mark = forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall d (m :: * -> *). MarkParsing d m => m d
mark
{-# inlinable mark #-}
release :: d -> ReaderT e m ()
release = forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall d (m :: * -> *). MarkParsing d m => d -> m ()
release
{-# inlinable release #-}
instance (MonadPlus m, MarkParsing d m, Monoid w) => MarkParsing d (Strict.WriterT w m) where
mark :: WriterT w m d
mark = forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall d (m :: * -> *). MarkParsing d m => m d
mark
{-# inlinable mark #-}
release :: d -> WriterT w m ()
release = forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall d (m :: * -> *). MarkParsing d m => d -> m ()
release
{-# inlinable release #-}
instance (MonadPlus m, MarkParsing d m, Monoid w) => MarkParsing d (Lazy.WriterT w m) where
mark :: WriterT w m d
mark = forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall d (m :: * -> *). MarkParsing d m => m d
mark
{-# inlinable mark #-}
release :: d -> WriterT w m ()
release = forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall d (m :: * -> *). MarkParsing d m => d -> m ()
release
{-# inlinable release #-}
instance (MonadPlus m, MarkParsing d m, Monoid w) => MarkParsing d (Lazy.RWST r w s m) where
mark :: RWST r w s m d
mark = forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall d (m :: * -> *). MarkParsing d m => m d
mark
{-# inlinable mark #-}
release :: d -> RWST r w s m ()
release = forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall d (m :: * -> *). MarkParsing d m => d -> m ()
release
{-# inlinable release #-}
instance (MonadPlus m, MarkParsing d m, Monoid w) => MarkParsing d (Strict.RWST r w s m) where
mark :: RWST r w s m d
mark = forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall d (m :: * -> *). MarkParsing d m => m d
mark
{-# inlinable mark #-}
release :: d -> RWST r w s m ()
release = forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall d (m :: * -> *). MarkParsing d m => d -> m ()
release
{-# inlinable release #-}
instance (MonadPlus m, MarkParsing d m) => MarkParsing d (IdentityT m) where
mark :: IdentityT m d
mark = forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall d (m :: * -> *). MarkParsing d m => m d
mark
{-# inlinable mark #-}
release :: d -> IdentityT m ()
release = forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall d (m :: * -> *). MarkParsing d m => d -> m ()
release
{-# inlinable release #-}