{-# LANGUAGE MultiParamTypeClasses #-}
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE CPP #-}
#if MIN_VERSION_base(4,9,0)
{-# OPTIONS_GHC -fno-warn-redundant-constraints -O2 #-}
#endif
#define OVERLAPS {-# OVERLAPPING #-}
module Text.Pandoc.Walk
( Walkable(..)
, queryBlock
, queryCaption
, queryRow
, queryTableHead
, queryTableBody
, queryTableFoot
, queryCell
, queryCitation
, queryInline
, queryMetaValue
, queryMetaValue'
, queryPandoc
, walkBlockM
, walkCaptionM
, walkRowM
, walkTableHeadM
, walkTableBodyM
, walkTableFootM
, walkCellM
, walkCitationM
, walkInlineM
, walkMetaValueM
, walkMetaValueM'
, walkPandocM
)
where
import Control.Applicative (Applicative ((<*>), pure), (<$>))
import Control.Monad ((>=>))
import Data.Functor.Identity (Identity (runIdentity))
import qualified Data.Map as M
import Text.Pandoc.Definition
import qualified Data.Traversable as T
import Data.Traversable (Traversable)
import qualified Data.Foldable as F
import Data.Foldable (Foldable)
import Data.Monoid ((<>))
class Walkable a b where
walk :: (a -> a) -> b -> b
walk a -> a
f = forall a. Identity a -> a
runIdentity forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall a b (m :: * -> *).
(Walkable a b, Monad m, Applicative m, Functor m) =>
(a -> m a) -> b -> m b
walkM (forall (m :: * -> *) a. Monad m => a -> m a
return forall b c a. (b -> c) -> (a -> b) -> a -> c
. a -> a
f)
walkM :: (Monad m, Applicative m, Functor m) => (a -> m a) -> b -> m b
query :: Monoid c => (a -> c) -> b -> c
{-# MINIMAL walkM, query #-}
instance (Foldable t, Traversable t, Walkable a b) => Walkable a (t b) where
walk :: (a -> a) -> t b -> t b
walk a -> a
f = forall (t :: * -> *) a b. Traversable t => (a -> b) -> t a -> t b
T.fmapDefault (forall a b. Walkable a b => (a -> a) -> b -> b
walk a -> a
f)
walkM :: forall (m :: * -> *).
(Monad m, Applicative m, Functor m) =>
(a -> m a) -> t b -> m (t b)
walkM a -> m a
f = forall (t :: * -> *) (m :: * -> *) a b.
(Traversable t, Monad m) =>
(a -> m b) -> t a -> m (t b)
T.mapM (forall a b (m :: * -> *).
(Walkable a b, Monad m, Applicative m, Functor m) =>
(a -> m a) -> b -> m b
walkM a -> m a
f)
query :: forall c. Monoid c => (a -> c) -> t b -> c
query a -> c
f = forall (t :: * -> *) m a.
(Foldable t, Monoid m) =>
(a -> m) -> t a -> m
F.foldMap (forall a b c. (Walkable a b, Monoid c) => (a -> c) -> b -> c
query a -> c
f)
instance OVERLAPS
(Walkable a b, Walkable a c) => Walkable a (b,c) where
walk :: (a -> a) -> (b, c) -> (b, c)
walk a -> a
f (b
x,c
y) = (forall a b. Walkable a b => (a -> a) -> b -> b
walk a -> a
f b
x, forall a b. Walkable a b => (a -> a) -> b -> b
walk a -> a
f c
y)
walkM :: forall (m :: * -> *).
(Monad m, Applicative m, Functor m) =>
(a -> m a) -> (b, c) -> m (b, c)
walkM a -> m a
f (b
x,c
y) = do b
x' <- forall a b (m :: * -> *).
(Walkable a b, Monad m, Applicative m, Functor m) =>
(a -> m a) -> b -> m b
walkM a -> m a
f b
x
c
y' <- forall a b (m :: * -> *).
(Walkable a b, Monad m, Applicative m, Functor m) =>
(a -> m a) -> b -> m b
walkM a -> m a
f c
y
forall (m :: * -> *) a. Monad m => a -> m a
return (b
x',c
y')
query :: forall c. Monoid c => (a -> c) -> (b, c) -> c
query a -> c
f (b
x,c
y) = forall a. Monoid a => a -> a -> a
mappend (forall a b c. (Walkable a b, Monoid c) => (a -> c) -> b -> c
query a -> c
f b
x) (forall a b c. (Walkable a b, Monoid c) => (a -> c) -> b -> c
query a -> c
f c
y)
instance Walkable Inline Inline where
walkM :: forall (m :: * -> *).
(Monad m, Applicative m, Functor m) =>
(Inline -> m Inline) -> Inline -> m Inline
walkM Inline -> m Inline
f Inline
x = forall a (m :: * -> *).
(Walkable a Citation, Walkable a [Block], Walkable a [Inline],
Monad m, Applicative m, Functor m) =>
(a -> m a) -> Inline -> m Inline
walkInlineM Inline -> m Inline
f Inline
x forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= Inline -> m Inline
f
query :: forall c. Monoid c => (Inline -> c) -> Inline -> c
query Inline -> c
f Inline
x = Inline -> c
f Inline
x forall a. Semigroup a => a -> a -> a
<> forall a c.
(Walkable a Citation, Walkable a [Block], Walkable a [Inline],
Monoid c) =>
(a -> c) -> Inline -> c
queryInline Inline -> c
f Inline
x
instance OVERLAPS
Walkable [Inline] [Inline] where
walkM :: forall (m :: * -> *).
(Monad m, Applicative m, Functor m) =>
([Inline] -> m [Inline]) -> [Inline] -> m [Inline]
walkM [Inline] -> m [Inline]
f = forall (t :: * -> *) (f :: * -> *) a b.
(Traversable t, Applicative f) =>
(a -> f b) -> t a -> f (t b)
T.traverse (forall a (m :: * -> *).
(Walkable a Citation, Walkable a [Block], Walkable a [Inline],
Monad m, Applicative m, Functor m) =>
(a -> m a) -> Inline -> m Inline
walkInlineM [Inline] -> m [Inline]
f) forall (m :: * -> *) a b c.
Monad m =>
(a -> m b) -> (b -> m c) -> a -> m c
>=> [Inline] -> m [Inline]
f
query :: forall c. Monoid c => ([Inline] -> c) -> [Inline] -> c
query [Inline] -> c
f [Inline]
inlns = [Inline] -> c
f [Inline]
inlns forall a. Semigroup a => a -> a -> a
<> forall a. Monoid a => [a] -> a
mconcat (forall a b. (a -> b) -> [a] -> [b]
map (forall a c.
(Walkable a Citation, Walkable a [Block], Walkable a [Inline],
Monoid c) =>
(a -> c) -> Inline -> c
queryInline [Inline] -> c
f) [Inline]
inlns)
instance Walkable [Inline] Inline where
walkM :: forall (m :: * -> *).
(Monad m, Applicative m, Functor m) =>
([Inline] -> m [Inline]) -> Inline -> m Inline
walkM = forall a (m :: * -> *).
(Walkable a Citation, Walkable a [Block], Walkable a [Inline],
Monad m, Applicative m, Functor m) =>
(a -> m a) -> Inline -> m Inline
walkInlineM
query :: forall c. Monoid c => ([Inline] -> c) -> Inline -> c
query = forall a c.
(Walkable a Citation, Walkable a [Block], Walkable a [Inline],
Monoid c) =>
(a -> c) -> Inline -> c
queryInline
instance Walkable Inline Block where
walkM :: forall (m :: * -> *).
(Monad m, Applicative m, Functor m) =>
(Inline -> m Inline) -> Block -> m Block
walkM = forall a (m :: * -> *).
(Walkable a [Block], Walkable a [Inline], Walkable a Row,
Walkable a Caption, Walkable a TableHead, Walkable a TableBody,
Walkable a TableFoot, Monad m, Applicative m, Functor m) =>
(a -> m a) -> Block -> m Block
walkBlockM
query :: forall c. Monoid c => (Inline -> c) -> Block -> c
query = forall a c.
(Walkable a Citation, Walkable a [Block], Walkable a Row,
Walkable a Caption, Walkable a TableHead, Walkable a TableBody,
Walkable a TableFoot, Walkable a [Inline], Monoid c) =>
(a -> c) -> Block -> c
queryBlock
instance Walkable [Inline] Block where
walkM :: forall (m :: * -> *).
(Monad m, Applicative m, Functor m) =>
([Inline] -> m [Inline]) -> Block -> m Block
walkM = forall a (m :: * -> *).
(Walkable a [Block], Walkable a [Inline], Walkable a Row,
Walkable a Caption, Walkable a TableHead, Walkable a TableBody,
Walkable a TableFoot, Monad m, Applicative m, Functor m) =>
(a -> m a) -> Block -> m Block
walkBlockM
query :: forall c. Monoid c => ([Inline] -> c) -> Block -> c
query = forall a c.
(Walkable a Citation, Walkable a [Block], Walkable a Row,
Walkable a Caption, Walkable a TableHead, Walkable a TableBody,
Walkable a TableFoot, Walkable a [Inline], Monoid c) =>
(a -> c) -> Block -> c
queryBlock
instance Walkable Block Block where
walkM :: forall (m :: * -> *).
(Monad m, Applicative m, Functor m) =>
(Block -> m Block) -> Block -> m Block
walkM Block -> m Block
f Block
x = forall a (m :: * -> *).
(Walkable a [Block], Walkable a [Inline], Walkable a Row,
Walkable a Caption, Walkable a TableHead, Walkable a TableBody,
Walkable a TableFoot, Monad m, Applicative m, Functor m) =>
(a -> m a) -> Block -> m Block
walkBlockM Block -> m Block
f Block
x forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= Block -> m Block
f
query :: forall c. Monoid c => (Block -> c) -> Block -> c
query Block -> c
f Block
x = Block -> c
f Block
x forall a. Semigroup a => a -> a -> a
<> forall a c.
(Walkable a Citation, Walkable a [Block], Walkable a Row,
Walkable a Caption, Walkable a TableHead, Walkable a TableBody,
Walkable a TableFoot, Walkable a [Inline], Monoid c) =>
(a -> c) -> Block -> c
queryBlock Block -> c
f Block
x
instance Walkable [Block] Block where
walkM :: forall (m :: * -> *).
(Monad m, Applicative m, Functor m) =>
([Block] -> m [Block]) -> Block -> m Block
walkM = forall a (m :: * -> *).
(Walkable a [Block], Walkable a [Inline], Walkable a Row,
Walkable a Caption, Walkable a TableHead, Walkable a TableBody,
Walkable a TableFoot, Monad m, Applicative m, Functor m) =>
(a -> m a) -> Block -> m Block
walkBlockM
query :: forall c. Monoid c => ([Block] -> c) -> Block -> c
query = forall a c.
(Walkable a Citation, Walkable a [Block], Walkable a Row,
Walkable a Caption, Walkable a TableHead, Walkable a TableBody,
Walkable a TableFoot, Walkable a [Inline], Monoid c) =>
(a -> c) -> Block -> c
queryBlock
instance OVERLAPS
Walkable [Block] [Block] where
walkM :: forall (m :: * -> *).
(Monad m, Applicative m, Functor m) =>
([Block] -> m [Block]) -> [Block] -> m [Block]
walkM [Block] -> m [Block]
f = forall (t :: * -> *) (f :: * -> *) a b.
(Traversable t, Applicative f) =>
(a -> f b) -> t a -> f (t b)
T.traverse (forall a (m :: * -> *).
(Walkable a [Block], Walkable a [Inline], Walkable a Row,
Walkable a Caption, Walkable a TableHead, Walkable a TableBody,
Walkable a TableFoot, Monad m, Applicative m, Functor m) =>
(a -> m a) -> Block -> m Block
walkBlockM [Block] -> m [Block]
f) forall (m :: * -> *) a b c.
Monad m =>
(a -> m b) -> (b -> m c) -> a -> m c
>=> [Block] -> m [Block]
f
query :: forall c. Monoid c => ([Block] -> c) -> [Block] -> c
query [Block] -> c
f [Block]
blks = [Block] -> c
f [Block]
blks forall a. Semigroup a => a -> a -> a
<> forall a. Monoid a => [a] -> a
mconcat (forall a b. (a -> b) -> [a] -> [b]
map (forall a c.
(Walkable a Citation, Walkable a [Block], Walkable a Row,
Walkable a Caption, Walkable a TableHead, Walkable a TableBody,
Walkable a TableFoot, Walkable a [Inline], Monoid c) =>
(a -> c) -> Block -> c
queryBlock [Block] -> c
f) [Block]
blks)
instance Walkable Block Inline where
walkM :: forall (m :: * -> *).
(Monad m, Applicative m, Functor m) =>
(Block -> m Block) -> Inline -> m Inline
walkM = forall a (m :: * -> *).
(Walkable a Citation, Walkable a [Block], Walkable a [Inline],
Monad m, Applicative m, Functor m) =>
(a -> m a) -> Inline -> m Inline
walkInlineM
query :: forall c. Monoid c => (Block -> c) -> Inline -> c
query = forall a c.
(Walkable a Citation, Walkable a [Block], Walkable a [Inline],
Monoid c) =>
(a -> c) -> Inline -> c
queryInline
instance Walkable [Block] Inline where
walkM :: forall (m :: * -> *).
(Monad m, Applicative m, Functor m) =>
([Block] -> m [Block]) -> Inline -> m Inline
walkM = forall a (m :: * -> *).
(Walkable a Citation, Walkable a [Block], Walkable a [Inline],
Monad m, Applicative m, Functor m) =>
(a -> m a) -> Inline -> m Inline
walkInlineM
query :: forall c. Monoid c => ([Block] -> c) -> Inline -> c
query = forall a c.
(Walkable a Citation, Walkable a [Block], Walkable a [Inline],
Monoid c) =>
(a -> c) -> Inline -> c
queryInline
instance Walkable Block Pandoc where
walkM :: forall (m :: * -> *).
(Monad m, Applicative m, Functor m) =>
(Block -> m Block) -> Pandoc -> m Pandoc
walkM = forall a (m :: * -> *).
(Walkable a Meta, Walkable a [Block], Monad m, Applicative m,
Functor m) =>
(a -> m a) -> Pandoc -> m Pandoc
walkPandocM
query :: forall c. Monoid c => (Block -> c) -> Pandoc -> c
query = forall a c.
(Walkable a Meta, Walkable a [Block], Monoid c) =>
(a -> c) -> Pandoc -> c
queryPandoc
instance Walkable [Block] Pandoc where
walkM :: forall (m :: * -> *).
(Monad m, Applicative m, Functor m) =>
([Block] -> m [Block]) -> Pandoc -> m Pandoc
walkM = forall a (m :: * -> *).
(Walkable a Meta, Walkable a [Block], Monad m, Applicative m,
Functor m) =>
(a -> m a) -> Pandoc -> m Pandoc
walkPandocM
query :: forall c. Monoid c => ([Block] -> c) -> Pandoc -> c
query = forall a c.
(Walkable a Meta, Walkable a [Block], Monoid c) =>
(a -> c) -> Pandoc -> c
queryPandoc
instance Walkable Inline Pandoc where
walkM :: forall (m :: * -> *).
(Monad m, Applicative m, Functor m) =>
(Inline -> m Inline) -> Pandoc -> m Pandoc
walkM = forall a (m :: * -> *).
(Walkable a Meta, Walkable a [Block], Monad m, Applicative m,
Functor m) =>
(a -> m a) -> Pandoc -> m Pandoc
walkPandocM
query :: forall c. Monoid c => (Inline -> c) -> Pandoc -> c
query = forall a c.
(Walkable a Meta, Walkable a [Block], Monoid c) =>
(a -> c) -> Pandoc -> c
queryPandoc
instance Walkable [Inline] Pandoc where
walkM :: forall (m :: * -> *).
(Monad m, Applicative m, Functor m) =>
([Inline] -> m [Inline]) -> Pandoc -> m Pandoc
walkM = forall a (m :: * -> *).
(Walkable a Meta, Walkable a [Block], Monad m, Applicative m,
Functor m) =>
(a -> m a) -> Pandoc -> m Pandoc
walkPandocM
query :: forall c. Monoid c => ([Inline] -> c) -> Pandoc -> c
query = forall a c.
(Walkable a Meta, Walkable a [Block], Monoid c) =>
(a -> c) -> Pandoc -> c
queryPandoc
instance Walkable Meta Pandoc where
walkM :: forall (m :: * -> *).
(Monad m, Applicative m, Functor m) =>
(Meta -> m Meta) -> Pandoc -> m Pandoc
walkM Meta -> m Meta
f (Pandoc Meta
m [Block]
bs) = Meta -> [Block] -> Pandoc
Pandoc forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Meta -> m Meta
f Meta
m forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> forall (f :: * -> *) a. Applicative f => a -> f a
pure [Block]
bs
query :: forall c. Monoid c => (Meta -> c) -> Pandoc -> c
query Meta -> c
f (Pandoc Meta
m [Block]
_) = Meta -> c
f Meta
m
instance Walkable MetaValue Pandoc where
walkM :: forall (m :: * -> *).
(Monad m, Applicative m, Functor m) =>
(MetaValue -> m MetaValue) -> Pandoc -> m Pandoc
walkM MetaValue -> m MetaValue
f (Pandoc Meta
m [Block]
bs) = Meta -> [Block] -> Pandoc
Pandoc forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> forall a b (m :: * -> *).
(Walkable a b, Monad m, Applicative m, Functor m) =>
(a -> m a) -> b -> m b
walkM MetaValue -> m MetaValue
f Meta
m forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> forall (f :: * -> *) a. Applicative f => a -> f a
pure [Block]
bs
query :: forall c. Monoid c => (MetaValue -> c) -> Pandoc -> c
query MetaValue -> c
f (Pandoc Meta
m [Block]
_) = forall a b c. (Walkable a b, Monoid c) => (a -> c) -> b -> c
query MetaValue -> c
f Meta
m
instance Walkable Pandoc Pandoc where
walkM :: forall (m :: * -> *).
(Monad m, Applicative m, Functor m) =>
(Pandoc -> m Pandoc) -> Pandoc -> m Pandoc
walkM Pandoc -> m Pandoc
f = Pandoc -> m Pandoc
f
query :: forall c. Monoid c => (Pandoc -> c) -> Pandoc -> c
query Pandoc -> c
f = Pandoc -> c
f
instance Walkable Meta Meta where
walkM :: forall (m :: * -> *).
(Monad m, Applicative m, Functor m) =>
(Meta -> m Meta) -> Meta -> m Meta
walkM Meta -> m Meta
f = Meta -> m Meta
f
query :: forall c. Monoid c => (Meta -> c) -> Meta -> c
query Meta -> c
f = Meta -> c
f
instance Walkable Inline Meta where
walkM :: forall (m :: * -> *).
(Monad m, Applicative m, Functor m) =>
(Inline -> m Inline) -> Meta -> m Meta
walkM Inline -> m Inline
f (Meta Map Text MetaValue
metamap) = Map Text MetaValue -> Meta
Meta forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> forall a b (m :: * -> *).
(Walkable a b, Monad m, Applicative m, Functor m) =>
(a -> m a) -> b -> m b
walkM Inline -> m Inline
f Map Text MetaValue
metamap
query :: forall c. Monoid c => (Inline -> c) -> Meta -> c
query Inline -> c
f (Meta Map Text MetaValue
metamap) = forall a b c. (Walkable a b, Monoid c) => (a -> c) -> b -> c
query Inline -> c
f Map Text MetaValue
metamap
instance Walkable [Inline] Meta where
walkM :: forall (m :: * -> *).
(Monad m, Applicative m, Functor m) =>
([Inline] -> m [Inline]) -> Meta -> m Meta
walkM [Inline] -> m [Inline]
f (Meta Map Text MetaValue
metamap) = Map Text MetaValue -> Meta
Meta forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> forall a b (m :: * -> *).
(Walkable a b, Monad m, Applicative m, Functor m) =>
(a -> m a) -> b -> m b
walkM [Inline] -> m [Inline]
f Map Text MetaValue
metamap
query :: forall c. Monoid c => ([Inline] -> c) -> Meta -> c
query [Inline] -> c
f (Meta Map Text MetaValue
metamap) = forall a b c. (Walkable a b, Monoid c) => (a -> c) -> b -> c
query [Inline] -> c
f Map Text MetaValue
metamap
instance Walkable Block Meta where
walkM :: forall (m :: * -> *).
(Monad m, Applicative m, Functor m) =>
(Block -> m Block) -> Meta -> m Meta
walkM Block -> m Block
f (Meta Map Text MetaValue
metamap) = Map Text MetaValue -> Meta
Meta forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> forall a b (m :: * -> *).
(Walkable a b, Monad m, Applicative m, Functor m) =>
(a -> m a) -> b -> m b
walkM Block -> m Block
f Map Text MetaValue
metamap
query :: forall c. Monoid c => (Block -> c) -> Meta -> c
query Block -> c
f (Meta Map Text MetaValue
metamap) = forall a b c. (Walkable a b, Monoid c) => (a -> c) -> b -> c
query Block -> c
f Map Text MetaValue
metamap
instance Walkable [Block] Meta where
walkM :: forall (m :: * -> *).
(Monad m, Applicative m, Functor m) =>
([Block] -> m [Block]) -> Meta -> m Meta
walkM [Block] -> m [Block]
f (Meta Map Text MetaValue
metamap) = Map Text MetaValue -> Meta
Meta forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> forall a b (m :: * -> *).
(Walkable a b, Monad m, Applicative m, Functor m) =>
(a -> m a) -> b -> m b
walkM [Block] -> m [Block]
f Map Text MetaValue
metamap
query :: forall c. Monoid c => ([Block] -> c) -> Meta -> c
query [Block] -> c
f (Meta Map Text MetaValue
metamap) = forall a b c. (Walkable a b, Monoid c) => (a -> c) -> b -> c
query [Block] -> c
f Map Text MetaValue
metamap
instance Walkable MetaValue Meta where
walkM :: forall (m :: * -> *).
(Monad m, Applicative m, Functor m) =>
(MetaValue -> m MetaValue) -> Meta -> m Meta
walkM MetaValue -> m MetaValue
f (Meta Map Text MetaValue
metamap) =
Map Text MetaValue -> Meta
Meta forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall k a. Eq k => [(k, a)] -> Map k a
M.fromAscList forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> forall (t :: * -> *) (m :: * -> *) a b.
(Traversable t, Monad m) =>
(a -> m b) -> t a -> m (t b)
mapM (\(Text
k, MetaValue
v) -> (,) Text
k forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> forall a b (m :: * -> *).
(Walkable a b, Monad m, Applicative m, Functor m) =>
(a -> m a) -> b -> m b
walkM MetaValue -> m MetaValue
f MetaValue
v) (forall k a. Map k a -> [(k, a)]
M.toAscList Map Text MetaValue
metamap)
query :: forall c. Monoid c => (MetaValue -> c) -> Meta -> c
query MetaValue -> c
f (Meta Map Text MetaValue
metamap) = forall m k a. Monoid m => (k -> a -> m) -> Map k a -> m
M.foldMapWithKey (forall a b. a -> b -> a
const forall a b. (a -> b) -> a -> b
$ forall a b c. (Walkable a b, Monoid c) => (a -> c) -> b -> c
query MetaValue -> c
f) Map Text MetaValue
metamap
instance Walkable MetaValue MetaValue where
walkM :: forall (m :: * -> *).
(Monad m, Applicative m, Functor m) =>
(MetaValue -> m MetaValue) -> MetaValue -> m MetaValue
walkM MetaValue -> m MetaValue
f MetaValue
x = forall (m :: * -> *).
(Monad m, Applicative m, Functor m) =>
(MetaValue -> m MetaValue) -> MetaValue -> m MetaValue
walkMetaValueM' MetaValue -> m MetaValue
f MetaValue
x forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= MetaValue -> m MetaValue
f
query :: forall c. Monoid c => (MetaValue -> c) -> MetaValue -> c
query MetaValue -> c
f MetaValue
x = MetaValue -> c
f MetaValue
x forall a. Semigroup a => a -> a -> a
<> forall c. Monoid c => (MetaValue -> c) -> MetaValue -> c
queryMetaValue' MetaValue -> c
f MetaValue
x
instance Walkable Inline MetaValue where
walkM :: forall (m :: * -> *).
(Monad m, Applicative m, Functor m) =>
(Inline -> m Inline) -> MetaValue -> m MetaValue
walkM = forall a (f :: * -> *).
(Walkable a MetaValue, Walkable a [Block], Walkable a [Inline],
Monad f, Applicative f, Functor f) =>
(a -> f a) -> MetaValue -> f MetaValue
walkMetaValueM
query :: forall c. Monoid c => (Inline -> c) -> MetaValue -> c
query = forall a c.
(Walkable a MetaValue, Walkable a [Block], Walkable a [Inline],
Monoid c) =>
(a -> c) -> MetaValue -> c
queryMetaValue
instance Walkable [Inline] MetaValue where
walkM :: forall (m :: * -> *).
(Monad m, Applicative m, Functor m) =>
([Inline] -> m [Inline]) -> MetaValue -> m MetaValue
walkM = forall a (f :: * -> *).
(Walkable a MetaValue, Walkable a [Block], Walkable a [Inline],
Monad f, Applicative f, Functor f) =>
(a -> f a) -> MetaValue -> f MetaValue
walkMetaValueM
query :: forall c. Monoid c => ([Inline] -> c) -> MetaValue -> c
query = forall a c.
(Walkable a MetaValue, Walkable a [Block], Walkable a [Inline],
Monoid c) =>
(a -> c) -> MetaValue -> c
queryMetaValue
instance Walkable Block MetaValue where
walkM :: forall (m :: * -> *).
(Monad m, Applicative m, Functor m) =>
(Block -> m Block) -> MetaValue -> m MetaValue
walkM = forall a (f :: * -> *).
(Walkable a MetaValue, Walkable a [Block], Walkable a [Inline],
Monad f, Applicative f, Functor f) =>
(a -> f a) -> MetaValue -> f MetaValue
walkMetaValueM
query :: forall c. Monoid c => (Block -> c) -> MetaValue -> c
query = forall a c.
(Walkable a MetaValue, Walkable a [Block], Walkable a [Inline],
Monoid c) =>
(a -> c) -> MetaValue -> c
queryMetaValue
instance Walkable [Block] MetaValue where
walkM :: forall (m :: * -> *).
(Monad m, Applicative m, Functor m) =>
([Block] -> m [Block]) -> MetaValue -> m MetaValue
walkM = forall a (f :: * -> *).
(Walkable a MetaValue, Walkable a [Block], Walkable a [Inline],
Monad f, Applicative f, Functor f) =>
(a -> f a) -> MetaValue -> f MetaValue
walkMetaValueM
query :: forall c. Monoid c => ([Block] -> c) -> MetaValue -> c
query = forall a c.
(Walkable a MetaValue, Walkable a [Block], Walkable a [Inline],
Monoid c) =>
(a -> c) -> MetaValue -> c
queryMetaValue
instance Walkable Inline Row where
walkM :: forall (m :: * -> *).
(Monad m, Applicative m, Functor m) =>
(Inline -> m Inline) -> Row -> m Row
walkM = forall a (m :: * -> *).
(Walkable a Cell, Monad m) =>
(a -> m a) -> Row -> m Row
walkRowM
query :: forall c. Monoid c => (Inline -> c) -> Row -> c
query = forall a c. (Walkable a Cell, Monoid c) => (a -> c) -> Row -> c
queryRow
instance Walkable [Inline] Row where
walkM :: forall (m :: * -> *).
(Monad m, Applicative m, Functor m) =>
([Inline] -> m [Inline]) -> Row -> m Row
walkM = forall a (m :: * -> *).
(Walkable a Cell, Monad m) =>
(a -> m a) -> Row -> m Row
walkRowM
query :: forall c. Monoid c => ([Inline] -> c) -> Row -> c
query = forall a c. (Walkable a Cell, Monoid c) => (a -> c) -> Row -> c
queryRow
instance Walkable Block Row where
walkM :: forall (m :: * -> *).
(Monad m, Applicative m, Functor m) =>
(Block -> m Block) -> Row -> m Row
walkM = forall a (m :: * -> *).
(Walkable a Cell, Monad m) =>
(a -> m a) -> Row -> m Row
walkRowM
query :: forall c. Monoid c => (Block -> c) -> Row -> c
query = forall a c. (Walkable a Cell, Monoid c) => (a -> c) -> Row -> c
queryRow
instance Walkable [Block] Row where
walkM :: forall (m :: * -> *).
(Monad m, Applicative m, Functor m) =>
([Block] -> m [Block]) -> Row -> m Row
walkM = forall a (m :: * -> *).
(Walkable a Cell, Monad m) =>
(a -> m a) -> Row -> m Row
walkRowM
query :: forall c. Monoid c => ([Block] -> c) -> Row -> c
query = forall a c. (Walkable a Cell, Monoid c) => (a -> c) -> Row -> c
queryRow
instance Walkable Inline TableHead where
walkM :: forall (m :: * -> *).
(Monad m, Applicative m, Functor m) =>
(Inline -> m Inline) -> TableHead -> m TableHead
walkM = forall a (m :: * -> *).
(Walkable a Row, Monad m) =>
(a -> m a) -> TableHead -> m TableHead
walkTableHeadM
query :: forall c. Monoid c => (Inline -> c) -> TableHead -> c
query = forall a c.
(Walkable a Row, Monoid c) =>
(a -> c) -> TableHead -> c
queryTableHead
instance Walkable [Inline] TableHead where
walkM :: forall (m :: * -> *).
(Monad m, Applicative m, Functor m) =>
([Inline] -> m [Inline]) -> TableHead -> m TableHead
walkM = forall a (m :: * -> *).
(Walkable a Row, Monad m) =>
(a -> m a) -> TableHead -> m TableHead
walkTableHeadM
query :: forall c. Monoid c => ([Inline] -> c) -> TableHead -> c
query = forall a c.
(Walkable a Row, Monoid c) =>
(a -> c) -> TableHead -> c
queryTableHead
instance Walkable Block TableHead where
walkM :: forall (m :: * -> *).
(Monad m, Applicative m, Functor m) =>
(Block -> m Block) -> TableHead -> m TableHead
walkM = forall a (m :: * -> *).
(Walkable a Row, Monad m) =>
(a -> m a) -> TableHead -> m TableHead
walkTableHeadM
query :: forall c. Monoid c => (Block -> c) -> TableHead -> c
query = forall a c.
(Walkable a Row, Monoid c) =>
(a -> c) -> TableHead -> c
queryTableHead
instance Walkable [Block] TableHead where
walkM :: forall (m :: * -> *).
(Monad m, Applicative m, Functor m) =>
([Block] -> m [Block]) -> TableHead -> m TableHead
walkM = forall a (m :: * -> *).
(Walkable a Row, Monad m) =>
(a -> m a) -> TableHead -> m TableHead
walkTableHeadM
query :: forall c. Monoid c => ([Block] -> c) -> TableHead -> c
query = forall a c.
(Walkable a Row, Monoid c) =>
(a -> c) -> TableHead -> c
queryTableHead
instance Walkable Inline TableBody where
walkM :: forall (m :: * -> *).
(Monad m, Applicative m, Functor m) =>
(Inline -> m Inline) -> TableBody -> m TableBody
walkM = forall a (m :: * -> *).
(Walkable a Row, Monad m) =>
(a -> m a) -> TableBody -> m TableBody
walkTableBodyM
query :: forall c. Monoid c => (Inline -> c) -> TableBody -> c
query = forall a c.
(Walkable a Row, Monoid c) =>
(a -> c) -> TableBody -> c
queryTableBody
instance Walkable [Inline] TableBody where
walkM :: forall (m :: * -> *).
(Monad m, Applicative m, Functor m) =>
([Inline] -> m [Inline]) -> TableBody -> m TableBody
walkM = forall a (m :: * -> *).
(Walkable a Row, Monad m) =>
(a -> m a) -> TableBody -> m TableBody
walkTableBodyM
query :: forall c. Monoid c => ([Inline] -> c) -> TableBody -> c
query = forall a c.
(Walkable a Row, Monoid c) =>
(a -> c) -> TableBody -> c
queryTableBody
instance Walkable Block TableBody where
walkM :: forall (m :: * -> *).
(Monad m, Applicative m, Functor m) =>
(Block -> m Block) -> TableBody -> m TableBody
walkM = forall a (m :: * -> *).
(Walkable a Row, Monad m) =>
(a -> m a) -> TableBody -> m TableBody
walkTableBodyM
query :: forall c. Monoid c => (Block -> c) -> TableBody -> c
query = forall a c.
(Walkable a Row, Monoid c) =>
(a -> c) -> TableBody -> c
queryTableBody
instance Walkable [Block] TableBody where
walkM :: forall (m :: * -> *).
(Monad m, Applicative m, Functor m) =>
([Block] -> m [Block]) -> TableBody -> m TableBody
walkM = forall a (m :: * -> *).
(Walkable a Row, Monad m) =>
(a -> m a) -> TableBody -> m TableBody
walkTableBodyM
query :: forall c. Monoid c => ([Block] -> c) -> TableBody -> c
query = forall a c.
(Walkable a Row, Monoid c) =>
(a -> c) -> TableBody -> c
queryTableBody
instance Walkable Inline TableFoot where
walkM :: forall (m :: * -> *).
(Monad m, Applicative m, Functor m) =>
(Inline -> m Inline) -> TableFoot -> m TableFoot
walkM = forall a (m :: * -> *).
(Walkable a Row, Monad m) =>
(a -> m a) -> TableFoot -> m TableFoot
walkTableFootM
query :: forall c. Monoid c => (Inline -> c) -> TableFoot -> c
query = forall a c.
(Walkable a Row, Monoid c) =>
(a -> c) -> TableFoot -> c
queryTableFoot
instance Walkable [Inline] TableFoot where
walkM :: forall (m :: * -> *).
(Monad m, Applicative m, Functor m) =>
([Inline] -> m [Inline]) -> TableFoot -> m TableFoot
walkM = forall a (m :: * -> *).
(Walkable a Row, Monad m) =>
(a -> m a) -> TableFoot -> m TableFoot
walkTableFootM
query :: forall c. Monoid c => ([Inline] -> c) -> TableFoot -> c
query = forall a c.
(Walkable a Row, Monoid c) =>
(a -> c) -> TableFoot -> c
queryTableFoot
instance Walkable Block TableFoot where
walkM :: forall (m :: * -> *).
(Monad m, Applicative m, Functor m) =>
(Block -> m Block) -> TableFoot -> m TableFoot
walkM = forall a (m :: * -> *).
(Walkable a Row, Monad m) =>
(a -> m a) -> TableFoot -> m TableFoot
walkTableFootM
query :: forall c. Monoid c => (Block -> c) -> TableFoot -> c
query = forall a c.
(Walkable a Row, Monoid c) =>
(a -> c) -> TableFoot -> c
queryTableFoot
instance Walkable [Block] TableFoot where
walkM :: forall (m :: * -> *).
(Monad m, Applicative m, Functor m) =>
([Block] -> m [Block]) -> TableFoot -> m TableFoot
walkM = forall a (m :: * -> *).
(Walkable a Row, Monad m) =>
(a -> m a) -> TableFoot -> m TableFoot
walkTableFootM
query :: forall c. Monoid c => ([Block] -> c) -> TableFoot -> c
query = forall a c.
(Walkable a Row, Monoid c) =>
(a -> c) -> TableFoot -> c
queryTableFoot
instance Walkable Inline Caption where
walkM :: forall (m :: * -> *).
(Monad m, Applicative m, Functor m) =>
(Inline -> m Inline) -> Caption -> m Caption
walkM = forall a (m :: * -> *).
(Walkable a [Block], Walkable a [Inline], Monad m,
Walkable a [Inline]) =>
(a -> m a) -> Caption -> m Caption
walkCaptionM
query :: forall c. Monoid c => (Inline -> c) -> Caption -> c
query = forall a c.
(Walkable a [Block], Walkable a [Inline], Walkable a [Inline],
Monoid c) =>
(a -> c) -> Caption -> c
queryCaption
instance Walkable [Inline] Caption where
walkM :: forall (m :: * -> *).
(Monad m, Applicative m, Functor m) =>
([Inline] -> m [Inline]) -> Caption -> m Caption
walkM = forall a (m :: * -> *).
(Walkable a [Block], Walkable a [Inline], Monad m,
Walkable a [Inline]) =>
(a -> m a) -> Caption -> m Caption
walkCaptionM
query :: forall c. Monoid c => ([Inline] -> c) -> Caption -> c
query = forall a c.
(Walkable a [Block], Walkable a [Inline], Walkable a [Inline],
Monoid c) =>
(a -> c) -> Caption -> c
queryCaption
instance Walkable Block Caption where
walkM :: forall (m :: * -> *).
(Monad m, Applicative m, Functor m) =>
(Block -> m Block) -> Caption -> m Caption
walkM = forall a (m :: * -> *).
(Walkable a [Block], Walkable a [Inline], Monad m,
Walkable a [Inline]) =>
(a -> m a) -> Caption -> m Caption
walkCaptionM
query :: forall c. Monoid c => (Block -> c) -> Caption -> c
query = forall a c.
(Walkable a [Block], Walkable a [Inline], Walkable a [Inline],
Monoid c) =>
(a -> c) -> Caption -> c
queryCaption
instance Walkable [Block] Caption where
walkM :: forall (m :: * -> *).
(Monad m, Applicative m, Functor m) =>
([Block] -> m [Block]) -> Caption -> m Caption
walkM = forall a (m :: * -> *).
(Walkable a [Block], Walkable a [Inline], Monad m,
Walkable a [Inline]) =>
(a -> m a) -> Caption -> m Caption
walkCaptionM
query :: forall c. Monoid c => ([Block] -> c) -> Caption -> c
query = forall a c.
(Walkable a [Block], Walkable a [Inline], Walkable a [Inline],
Monoid c) =>
(a -> c) -> Caption -> c
queryCaption
instance Walkable Inline Cell where
walkM :: forall (m :: * -> *).
(Monad m, Applicative m, Functor m) =>
(Inline -> m Inline) -> Cell -> m Cell
walkM = forall a (m :: * -> *).
(Walkable a [Block], Monad m) =>
(a -> m a) -> Cell -> m Cell
walkCellM
query :: forall c. Monoid c => (Inline -> c) -> Cell -> c
query = forall a c. (Walkable a [Block], Monoid c) => (a -> c) -> Cell -> c
queryCell
instance Walkable [Inline] Cell where
walkM :: forall (m :: * -> *).
(Monad m, Applicative m, Functor m) =>
([Inline] -> m [Inline]) -> Cell -> m Cell
walkM = forall a (m :: * -> *).
(Walkable a [Block], Monad m) =>
(a -> m a) -> Cell -> m Cell
walkCellM
query :: forall c. Monoid c => ([Inline] -> c) -> Cell -> c
query = forall a c. (Walkable a [Block], Monoid c) => (a -> c) -> Cell -> c
queryCell
instance Walkable Block Cell where
walkM :: forall (m :: * -> *).
(Monad m, Applicative m, Functor m) =>
(Block -> m Block) -> Cell -> m Cell
walkM = forall a (m :: * -> *).
(Walkable a [Block], Monad m) =>
(a -> m a) -> Cell -> m Cell
walkCellM
query :: forall c. Monoid c => (Block -> c) -> Cell -> c
query = forall a c. (Walkable a [Block], Monoid c) => (a -> c) -> Cell -> c
queryCell
instance Walkable [Block] Cell where
walkM :: forall (m :: * -> *).
(Monad m, Applicative m, Functor m) =>
([Block] -> m [Block]) -> Cell -> m Cell
walkM = forall a (m :: * -> *).
(Walkable a [Block], Monad m) =>
(a -> m a) -> Cell -> m Cell
walkCellM
query :: forall c. Monoid c => ([Block] -> c) -> Cell -> c
query = forall a c. (Walkable a [Block], Monoid c) => (a -> c) -> Cell -> c
queryCell
instance Walkable Inline Citation where
walkM :: forall (m :: * -> *).
(Monad m, Applicative m, Functor m) =>
(Inline -> m Inline) -> Citation -> m Citation
walkM = forall a (m :: * -> *).
(Walkable a [Inline], Monad m, Applicative m, Functor m) =>
(a -> m a) -> Citation -> m Citation
walkCitationM
query :: forall c. Monoid c => (Inline -> c) -> Citation -> c
query = forall a c.
(Walkable a [Inline], Monoid c) =>
(a -> c) -> Citation -> c
queryCitation
instance Walkable [Inline] Citation where
walkM :: forall (m :: * -> *).
(Monad m, Applicative m, Functor m) =>
([Inline] -> m [Inline]) -> Citation -> m Citation
walkM = forall a (m :: * -> *).
(Walkable a [Inline], Monad m, Applicative m, Functor m) =>
(a -> m a) -> Citation -> m Citation
walkCitationM
query :: forall c. Monoid c => ([Inline] -> c) -> Citation -> c
query = forall a c.
(Walkable a [Inline], Monoid c) =>
(a -> c) -> Citation -> c
queryCitation
instance Walkable Block Citation where
walkM :: forall (m :: * -> *).
(Monad m, Applicative m, Functor m) =>
(Block -> m Block) -> Citation -> m Citation
walkM = forall a (m :: * -> *).
(Walkable a [Inline], Monad m, Applicative m, Functor m) =>
(a -> m a) -> Citation -> m Citation
walkCitationM
query :: forall c. Monoid c => (Block -> c) -> Citation -> c
query = forall a c.
(Walkable a [Inline], Monoid c) =>
(a -> c) -> Citation -> c
queryCitation
instance Walkable [Block] Citation where
walkM :: forall (m :: * -> *).
(Monad m, Applicative m, Functor m) =>
([Block] -> m [Block]) -> Citation -> m Citation
walkM = forall a (m :: * -> *).
(Walkable a [Inline], Monad m, Applicative m, Functor m) =>
(a -> m a) -> Citation -> m Citation
walkCitationM
query :: forall c. Monoid c => ([Block] -> c) -> Citation -> c
query = forall a c.
(Walkable a [Inline], Monoid c) =>
(a -> c) -> Citation -> c
queryCitation
walkInlineM :: (Walkable a Citation, Walkable a [Block],
Walkable a [Inline], Monad m, Applicative m, Functor m)
=> (a -> m a) -> Inline -> m Inline
walkInlineM :: forall a (m :: * -> *).
(Walkable a Citation, Walkable a [Block], Walkable a [Inline],
Monad m, Applicative m, Functor m) =>
(a -> m a) -> Inline -> m Inline
walkInlineM a -> m a
_ (Str Text
xs) = forall (m :: * -> *) a. Monad m => a -> m a
return (Text -> Inline
Str Text
xs)
walkInlineM a -> m a
f (Emph [Inline]
xs) = [Inline] -> Inline
Emph forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> forall a b (m :: * -> *).
(Walkable a b, Monad m, Applicative m, Functor m) =>
(a -> m a) -> b -> m b
walkM a -> m a
f [Inline]
xs
walkInlineM a -> m a
f (Underline [Inline]
xs) = [Inline] -> Inline
Underline forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> forall a b (m :: * -> *).
(Walkable a b, Monad m, Applicative m, Functor m) =>
(a -> m a) -> b -> m b
walkM a -> m a
f [Inline]
xs
walkInlineM a -> m a
f (Strong [Inline]
xs) = [Inline] -> Inline
Strong forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> forall a b (m :: * -> *).
(Walkable a b, Monad m, Applicative m, Functor m) =>
(a -> m a) -> b -> m b
walkM a -> m a
f [Inline]
xs
walkInlineM a -> m a
f (Strikeout [Inline]
xs) = [Inline] -> Inline
Strikeout forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> forall a b (m :: * -> *).
(Walkable a b, Monad m, Applicative m, Functor m) =>
(a -> m a) -> b -> m b
walkM a -> m a
f [Inline]
xs
walkInlineM a -> m a
f (Subscript [Inline]
xs) = [Inline] -> Inline
Subscript forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> forall a b (m :: * -> *).
(Walkable a b, Monad m, Applicative m, Functor m) =>
(a -> m a) -> b -> m b
walkM a -> m a
f [Inline]
xs
walkInlineM a -> m a
f (Superscript [Inline]
xs) = [Inline] -> Inline
Superscript forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> forall a b (m :: * -> *).
(Walkable a b, Monad m, Applicative m, Functor m) =>
(a -> m a) -> b -> m b
walkM a -> m a
f [Inline]
xs
walkInlineM a -> m a
f (SmallCaps [Inline]
xs) = [Inline] -> Inline
SmallCaps forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> forall a b (m :: * -> *).
(Walkable a b, Monad m, Applicative m, Functor m) =>
(a -> m a) -> b -> m b
walkM a -> m a
f [Inline]
xs
walkInlineM a -> m a
f (Quoted QuoteType
qt [Inline]
xs) = QuoteType -> [Inline] -> Inline
Quoted QuoteType
qt forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> forall a b (m :: * -> *).
(Walkable a b, Monad m, Applicative m, Functor m) =>
(a -> m a) -> b -> m b
walkM a -> m a
f [Inline]
xs
walkInlineM a -> m a
f (Link Attr
atr [Inline]
xs Target
t) = Attr -> [Inline] -> Target -> Inline
Link Attr
atr forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> forall a b (m :: * -> *).
(Walkable a b, Monad m, Applicative m, Functor m) =>
(a -> m a) -> b -> m b
walkM a -> m a
f [Inline]
xs forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> forall (f :: * -> *) a. Applicative f => a -> f a
pure Target
t
walkInlineM a -> m a
f (Image Attr
atr [Inline]
xs Target
t) = Attr -> [Inline] -> Target -> Inline
Image Attr
atr forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> forall a b (m :: * -> *).
(Walkable a b, Monad m, Applicative m, Functor m) =>
(a -> m a) -> b -> m b
walkM a -> m a
f [Inline]
xs forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> forall (f :: * -> *) a. Applicative f => a -> f a
pure Target
t
walkInlineM a -> m a
f (Note [Block]
bs) = [Block] -> Inline
Note forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> forall a b (m :: * -> *).
(Walkable a b, Monad m, Applicative m, Functor m) =>
(a -> m a) -> b -> m b
walkM a -> m a
f [Block]
bs
walkInlineM a -> m a
f (Span Attr
attr [Inline]
xs) = Attr -> [Inline] -> Inline
Span Attr
attr forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> forall a b (m :: * -> *).
(Walkable a b, Monad m, Applicative m, Functor m) =>
(a -> m a) -> b -> m b
walkM a -> m a
f [Inline]
xs
walkInlineM a -> m a
f (Cite [Citation]
cs [Inline]
xs) = [Citation] -> [Inline] -> Inline
Cite forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> forall a b (m :: * -> *).
(Walkable a b, Monad m, Applicative m, Functor m) =>
(a -> m a) -> b -> m b
walkM a -> m a
f [Citation]
cs forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> forall a b (m :: * -> *).
(Walkable a b, Monad m, Applicative m, Functor m) =>
(a -> m a) -> b -> m b
walkM a -> m a
f [Inline]
xs
walkInlineM a -> m a
_ Inline
LineBreak = forall (m :: * -> *) a. Monad m => a -> m a
return Inline
LineBreak
walkInlineM a -> m a
_ Inline
SoftBreak = forall (m :: * -> *) a. Monad m => a -> m a
return Inline
SoftBreak
walkInlineM a -> m a
_ Inline
Space = forall (m :: * -> *) a. Monad m => a -> m a
return Inline
Space
walkInlineM a -> m a
_ x :: Inline
x@Code {} = forall (m :: * -> *) a. Monad m => a -> m a
return Inline
x
walkInlineM a -> m a
_ x :: Inline
x@Math {} = forall (m :: * -> *) a. Monad m => a -> m a
return Inline
x
walkInlineM a -> m a
_ x :: Inline
x@RawInline {} = forall (m :: * -> *) a. Monad m => a -> m a
return Inline
x
queryInline :: (Walkable a Citation, Walkable a [Block],
Walkable a [Inline], Monoid c)
=> (a -> c) -> Inline -> c
queryInline :: forall a c.
(Walkable a Citation, Walkable a [Block], Walkable a [Inline],
Monoid c) =>
(a -> c) -> Inline -> c
queryInline a -> c
_ (Str Text
_) = forall a. Monoid a => a
mempty
queryInline a -> c
f (Emph [Inline]
xs) = forall a b c. (Walkable a b, Monoid c) => (a -> c) -> b -> c
query a -> c
f [Inline]
xs
queryInline a -> c
f (Underline [Inline]
xs) = forall a b c. (Walkable a b, Monoid c) => (a -> c) -> b -> c
query a -> c
f [Inline]
xs
queryInline a -> c
f (Strong [Inline]
xs) = forall a b c. (Walkable a b, Monoid c) => (a -> c) -> b -> c
query a -> c
f [Inline]
xs
queryInline a -> c
f (Strikeout [Inline]
xs) = forall a b c. (Walkable a b, Monoid c) => (a -> c) -> b -> c
query a -> c
f [Inline]
xs
queryInline a -> c
f (Subscript [Inline]
xs) = forall a b c. (Walkable a b, Monoid c) => (a -> c) -> b -> c
query a -> c
f [Inline]
xs
queryInline a -> c
f (Superscript [Inline]
xs)= forall a b c. (Walkable a b, Monoid c) => (a -> c) -> b -> c
query a -> c
f [Inline]
xs
queryInline a -> c
f (SmallCaps [Inline]
xs) = forall a b c. (Walkable a b, Monoid c) => (a -> c) -> b -> c
query a -> c
f [Inline]
xs
queryInline a -> c
f (Quoted QuoteType
_ [Inline]
xs) = forall a b c. (Walkable a b, Monoid c) => (a -> c) -> b -> c
query a -> c
f [Inline]
xs
queryInline a -> c
f (Cite [Citation]
cs [Inline]
xs) = forall a b c. (Walkable a b, Monoid c) => (a -> c) -> b -> c
query a -> c
f [Citation]
cs forall a. Semigroup a => a -> a -> a
<> forall a b c. (Walkable a b, Monoid c) => (a -> c) -> b -> c
query a -> c
f [Inline]
xs
queryInline a -> c
_ (Code Attr
_ Text
_) = forall a. Monoid a => a
mempty
queryInline a -> c
_ Inline
Space = forall a. Monoid a => a
mempty
queryInline a -> c
_ Inline
SoftBreak = forall a. Monoid a => a
mempty
queryInline a -> c
_ Inline
LineBreak = forall a. Monoid a => a
mempty
queryInline a -> c
_ (Math MathType
_ Text
_) = forall a. Monoid a => a
mempty
queryInline a -> c
_ (RawInline Format
_ Text
_) = forall a. Monoid a => a
mempty
queryInline a -> c
f (Link Attr
_ [Inline]
xs Target
_) = forall a b c. (Walkable a b, Monoid c) => (a -> c) -> b -> c
query a -> c
f [Inline]
xs
queryInline a -> c
f (Image Attr
_ [Inline]
xs Target
_) = forall a b c. (Walkable a b, Monoid c) => (a -> c) -> b -> c
query a -> c
f [Inline]
xs
queryInline a -> c
f (Note [Block]
bs) = forall a b c. (Walkable a b, Monoid c) => (a -> c) -> b -> c
query a -> c
f [Block]
bs
queryInline a -> c
f (Span Attr
_ [Inline]
xs) = forall a b c. (Walkable a b, Monoid c) => (a -> c) -> b -> c
query a -> c
f [Inline]
xs
walkBlockM :: (Walkable a [Block], Walkable a [Inline], Walkable a Row,
Walkable a Caption, Walkable a TableHead, Walkable a TableBody,
Walkable a TableFoot, Monad m, Applicative m, Functor m)
=> (a -> m a) -> Block -> m Block
walkBlockM :: forall a (m :: * -> *).
(Walkable a [Block], Walkable a [Inline], Walkable a Row,
Walkable a Caption, Walkable a TableHead, Walkable a TableBody,
Walkable a TableFoot, Monad m, Applicative m, Functor m) =>
(a -> m a) -> Block -> m Block
walkBlockM a -> m a
f (Para [Inline]
xs) = [Inline] -> Block
Para forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> forall a b (m :: * -> *).
(Walkable a b, Monad m, Applicative m, Functor m) =>
(a -> m a) -> b -> m b
walkM a -> m a
f [Inline]
xs
walkBlockM a -> m a
f (Plain [Inline]
xs) = [Inline] -> Block
Plain forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> forall a b (m :: * -> *).
(Walkable a b, Monad m, Applicative m, Functor m) =>
(a -> m a) -> b -> m b
walkM a -> m a
f [Inline]
xs
walkBlockM a -> m a
f (LineBlock [[Inline]]
xs) = [[Inline]] -> Block
LineBlock forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> forall a b (m :: * -> *).
(Walkable a b, Monad m, Applicative m, Functor m) =>
(a -> m a) -> b -> m b
walkM a -> m a
f [[Inline]]
xs
walkBlockM a -> m a
f (BlockQuote [Block]
xs) = [Block] -> Block
BlockQuote forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> forall a b (m :: * -> *).
(Walkable a b, Monad m, Applicative m, Functor m) =>
(a -> m a) -> b -> m b
walkM a -> m a
f [Block]
xs
walkBlockM a -> m a
f (OrderedList ListAttributes
a [[Block]]
cs) = ListAttributes -> [[Block]] -> Block
OrderedList ListAttributes
a forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> forall a b (m :: * -> *).
(Walkable a b, Monad m, Applicative m, Functor m) =>
(a -> m a) -> b -> m b
walkM a -> m a
f [[Block]]
cs
walkBlockM a -> m a
f (BulletList [[Block]]
cs) = [[Block]] -> Block
BulletList forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> forall a b (m :: * -> *).
(Walkable a b, Monad m, Applicative m, Functor m) =>
(a -> m a) -> b -> m b
walkM a -> m a
f [[Block]]
cs
walkBlockM a -> m a
f (DefinitionList [([Inline], [[Block]])]
xs) = [([Inline], [[Block]])] -> Block
DefinitionList forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> forall a b (m :: * -> *).
(Walkable a b, Monad m, Applicative m, Functor m) =>
(a -> m a) -> b -> m b
walkM a -> m a
f [([Inline], [[Block]])]
xs
walkBlockM a -> m a
f (Header Int
lev Attr
attr [Inline]
xs) = Int -> Attr -> [Inline] -> Block
Header Int
lev Attr
attr forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> forall a b (m :: * -> *).
(Walkable a b, Monad m, Applicative m, Functor m) =>
(a -> m a) -> b -> m b
walkM a -> m a
f [Inline]
xs
walkBlockM a -> m a
f (Div Attr
attr [Block]
bs') = Attr -> [Block] -> Block
Div Attr
attr forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> forall a b (m :: * -> *).
(Walkable a b, Monad m, Applicative m, Functor m) =>
(a -> m a) -> b -> m b
walkM a -> m a
f [Block]
bs'
walkBlockM a -> m a
_ x :: Block
x@CodeBlock {} = forall (m :: * -> *) a. Monad m => a -> m a
return Block
x
walkBlockM a -> m a
_ x :: Block
x@RawBlock {} = forall (m :: * -> *) a. Monad m => a -> m a
return Block
x
walkBlockM a -> m a
_ Block
HorizontalRule = forall (m :: * -> *) a. Monad m => a -> m a
return Block
HorizontalRule
walkBlockM a -> m a
f (Table Attr
attr Caption
capt [ColSpec]
as TableHead
hs [TableBody]
bs TableFoot
fs)
= do Caption
capt' <- forall a b (m :: * -> *).
(Walkable a b, Monad m, Applicative m, Functor m) =>
(a -> m a) -> b -> m b
walkM a -> m a
f Caption
capt
TableHead
hs' <- forall a b (m :: * -> *).
(Walkable a b, Monad m, Applicative m, Functor m) =>
(a -> m a) -> b -> m b
walkM a -> m a
f TableHead
hs
[TableBody]
bs' <- forall a b (m :: * -> *).
(Walkable a b, Monad m, Applicative m, Functor m) =>
(a -> m a) -> b -> m b
walkM a -> m a
f [TableBody]
bs
TableFoot
fs' <- forall a b (m :: * -> *).
(Walkable a b, Monad m, Applicative m, Functor m) =>
(a -> m a) -> b -> m b
walkM a -> m a
f TableFoot
fs
forall (m :: * -> *) a. Monad m => a -> m a
return forall a b. (a -> b) -> a -> b
$ Attr
-> Caption
-> [ColSpec]
-> TableHead
-> [TableBody]
-> TableFoot
-> Block
Table Attr
attr Caption
capt' [ColSpec]
as TableHead
hs' [TableBody]
bs' TableFoot
fs'
walkBlockM a -> m a
f (Figure Attr
attr Caption
capt [Block]
blks)
= do Caption
capt' <- forall a b (m :: * -> *).
(Walkable a b, Monad m, Applicative m, Functor m) =>
(a -> m a) -> b -> m b
walkM a -> m a
f Caption
capt
[Block]
blks' <- forall a b (m :: * -> *).
(Walkable a b, Monad m, Applicative m, Functor m) =>
(a -> m a) -> b -> m b
walkM a -> m a
f [Block]
blks
forall (m :: * -> *) a. Monad m => a -> m a
return forall a b. (a -> b) -> a -> b
$ Attr -> Caption -> [Block] -> Block
Figure Attr
attr Caption
capt' [Block]
blks'
queryBlock :: (Walkable a Citation, Walkable a [Block], Walkable a Row,
Walkable a Caption, Walkable a TableHead, Walkable a TableBody,
Walkable a TableFoot, Walkable a [Inline], Monoid c)
=> (a -> c) -> Block -> c
queryBlock :: forall a c.
(Walkable a Citation, Walkable a [Block], Walkable a Row,
Walkable a Caption, Walkable a TableHead, Walkable a TableBody,
Walkable a TableFoot, Walkable a [Inline], Monoid c) =>
(a -> c) -> Block -> c
queryBlock a -> c
f (Para [Inline]
xs) = forall a b c. (Walkable a b, Monoid c) => (a -> c) -> b -> c
query a -> c
f [Inline]
xs
queryBlock a -> c
f (Plain [Inline]
xs) = forall a b c. (Walkable a b, Monoid c) => (a -> c) -> b -> c
query a -> c
f [Inline]
xs
queryBlock a -> c
f (LineBlock [[Inline]]
xs) = forall a b c. (Walkable a b, Monoid c) => (a -> c) -> b -> c
query a -> c
f [[Inline]]
xs
queryBlock a -> c
_ (CodeBlock Attr
_ Text
_) = forall a. Monoid a => a
mempty
queryBlock a -> c
_ (RawBlock Format
_ Text
_) = forall a. Monoid a => a
mempty
queryBlock a -> c
f (BlockQuote [Block]
bs) = forall a b c. (Walkable a b, Monoid c) => (a -> c) -> b -> c
query a -> c
f [Block]
bs
queryBlock a -> c
f (OrderedList ListAttributes
_ [[Block]]
cs) = forall a b c. (Walkable a b, Monoid c) => (a -> c) -> b -> c
query a -> c
f [[Block]]
cs
queryBlock a -> c
f (BulletList [[Block]]
cs) = forall a b c. (Walkable a b, Monoid c) => (a -> c) -> b -> c
query a -> c
f [[Block]]
cs
queryBlock a -> c
f (DefinitionList [([Inline], [[Block]])]
xs) = forall a b c. (Walkable a b, Monoid c) => (a -> c) -> b -> c
query a -> c
f [([Inline], [[Block]])]
xs
queryBlock a -> c
f (Header Int
_ Attr
_ [Inline]
xs) = forall a b c. (Walkable a b, Monoid c) => (a -> c) -> b -> c
query a -> c
f [Inline]
xs
queryBlock a -> c
_ Block
HorizontalRule = forall a. Monoid a => a
mempty
queryBlock a -> c
f (Table Attr
_ Caption
capt [ColSpec]
_ TableHead
hs [TableBody]
bs TableFoot
fs)
= forall a b c. (Walkable a b, Monoid c) => (a -> c) -> b -> c
query a -> c
f Caption
capt forall a. Semigroup a => a -> a -> a
<>
forall a b c. (Walkable a b, Monoid c) => (a -> c) -> b -> c
query a -> c
f TableHead
hs forall a. Semigroup a => a -> a -> a
<>
forall a b c. (Walkable a b, Monoid c) => (a -> c) -> b -> c
query a -> c
f [TableBody]
bs forall a. Semigroup a => a -> a -> a
<>
forall a b c. (Walkable a b, Monoid c) => (a -> c) -> b -> c
query a -> c
f TableFoot
fs
queryBlock a -> c
f (Figure Attr
_ Caption
capt [Block]
blks)
= forall a b c. (Walkable a b, Monoid c) => (a -> c) -> b -> c
query a -> c
f Caption
capt forall a. Semigroup a => a -> a -> a
<>
forall a b c. (Walkable a b, Monoid c) => (a -> c) -> b -> c
query a -> c
f [Block]
blks
queryBlock a -> c
f (Div Attr
_ [Block]
bs) = forall a b c. (Walkable a b, Monoid c) => (a -> c) -> b -> c
query a -> c
f [Block]
bs
walkMetaValueM :: (Walkable a MetaValue, Walkable a [Block],
Walkable a [Inline], Monad f, Applicative f, Functor f)
=> (a -> f a) -> MetaValue -> f MetaValue
walkMetaValueM :: forall a (f :: * -> *).
(Walkable a MetaValue, Walkable a [Block], Walkable a [Inline],
Monad f, Applicative f, Functor f) =>
(a -> f a) -> MetaValue -> f MetaValue
walkMetaValueM a -> f a
f (MetaList [MetaValue]
xs) = [MetaValue] -> MetaValue
MetaList forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> forall a b (m :: * -> *).
(Walkable a b, Monad m, Applicative m, Functor m) =>
(a -> m a) -> b -> m b
walkM a -> f a
f [MetaValue]
xs
walkMetaValueM a -> f a
_ (MetaBool Bool
b) = forall (m :: * -> *) a. Monad m => a -> m a
return forall a b. (a -> b) -> a -> b
$ Bool -> MetaValue
MetaBool Bool
b
walkMetaValueM a -> f a
_ (MetaString Text
s) = forall (m :: * -> *) a. Monad m => a -> m a
return forall a b. (a -> b) -> a -> b
$ Text -> MetaValue
MetaString Text
s
walkMetaValueM a -> f a
f (MetaInlines [Inline]
xs) = [Inline] -> MetaValue
MetaInlines forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> forall a b (m :: * -> *).
(Walkable a b, Monad m, Applicative m, Functor m) =>
(a -> m a) -> b -> m b
walkM a -> f a
f [Inline]
xs
walkMetaValueM a -> f a
f (MetaBlocks [Block]
bs) = [Block] -> MetaValue
MetaBlocks forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> forall a b (m :: * -> *).
(Walkable a b, Monad m, Applicative m, Functor m) =>
(a -> m a) -> b -> m b
walkM a -> f a
f [Block]
bs
walkMetaValueM a -> f a
f (MetaMap Map Text MetaValue
m) = Map Text MetaValue -> MetaValue
MetaMap forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> forall a b (m :: * -> *).
(Walkable a b, Monad m, Applicative m, Functor m) =>
(a -> m a) -> b -> m b
walkM a -> f a
f Map Text MetaValue
m
walkMetaValueM' :: (Monad f, Applicative f, Functor f)
=> (MetaValue -> f MetaValue) -> MetaValue -> f MetaValue
walkMetaValueM' :: forall (m :: * -> *).
(Monad m, Applicative m, Functor m) =>
(MetaValue -> m MetaValue) -> MetaValue -> m MetaValue
walkMetaValueM' MetaValue -> f MetaValue
f (MetaMap Map Text MetaValue
m) =
Map Text MetaValue -> MetaValue
MetaMap forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall k a. Eq k => [(k, a)] -> Map k a
M.fromAscList forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> forall (t :: * -> *) (m :: * -> *) a b.
(Traversable t, Monad m) =>
(a -> m b) -> t a -> m (t b)
mapM (\(Text
k, MetaValue
v) -> (,) Text
k forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> forall a b (m :: * -> *).
(Walkable a b, Monad m, Applicative m, Functor m) =>
(a -> m a) -> b -> m b
walkM MetaValue -> f MetaValue
f MetaValue
v) (forall k a. Map k a -> [(k, a)]
M.toAscList Map Text MetaValue
m)
walkMetaValueM' MetaValue -> f MetaValue
f (MetaList [MetaValue]
xs) = [MetaValue] -> MetaValue
MetaList forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> forall (t :: * -> *) (m :: * -> *) a b.
(Traversable t, Monad m) =>
(a -> m b) -> t a -> m (t b)
mapM (forall a b (m :: * -> *).
(Walkable a b, Monad m, Applicative m, Functor m) =>
(a -> m a) -> b -> m b
walkM MetaValue -> f MetaValue
f) [MetaValue]
xs
walkMetaValueM' MetaValue -> f MetaValue
_ MetaValue
x = forall (m :: * -> *) a. Monad m => a -> m a
return MetaValue
x
queryMetaValue :: (Walkable a MetaValue, Walkable a [Block],
Walkable a [Inline], Monoid c)
=> (a -> c) -> MetaValue -> c
queryMetaValue :: forall a c.
(Walkable a MetaValue, Walkable a [Block], Walkable a [Inline],
Monoid c) =>
(a -> c) -> MetaValue -> c
queryMetaValue a -> c
f (MetaList [MetaValue]
xs) = forall a b c. (Walkable a b, Monoid c) => (a -> c) -> b -> c
query a -> c
f [MetaValue]
xs
queryMetaValue a -> c
_ (MetaBool Bool
_) = forall a. Monoid a => a
mempty
queryMetaValue a -> c
_ (MetaString Text
_) = forall a. Monoid a => a
mempty
queryMetaValue a -> c
f (MetaInlines [Inline]
xs) = forall a b c. (Walkable a b, Monoid c) => (a -> c) -> b -> c
query a -> c
f [Inline]
xs
queryMetaValue a -> c
f (MetaBlocks [Block]
bs) = forall a b c. (Walkable a b, Monoid c) => (a -> c) -> b -> c
query a -> c
f [Block]
bs
queryMetaValue a -> c
f (MetaMap Map Text MetaValue
m) = forall a b c. (Walkable a b, Monoid c) => (a -> c) -> b -> c
query a -> c
f Map Text MetaValue
m
queryMetaValue' :: Monoid c
=> (MetaValue -> c) -> MetaValue -> c
queryMetaValue' :: forall c. Monoid c => (MetaValue -> c) -> MetaValue -> c
queryMetaValue' MetaValue -> c
f (MetaMap Map Text MetaValue
m) = forall m k a. Monoid m => (k -> a -> m) -> Map k a -> m
M.foldMapWithKey (forall a b. a -> b -> a
const forall a b. (a -> b) -> a -> b
$ forall a b c. (Walkable a b, Monoid c) => (a -> c) -> b -> c
query MetaValue -> c
f) Map Text MetaValue
m
queryMetaValue' MetaValue -> c
f (MetaList [MetaValue]
xs) = forall a. Monoid a => [a] -> a
mconcat forall a b. (a -> b) -> a -> b
$ forall a b. (a -> b) -> [a] -> [b]
map (forall a b c. (Walkable a b, Monoid c) => (a -> c) -> b -> c
query MetaValue -> c
f) [MetaValue]
xs
queryMetaValue' MetaValue -> c
_ MetaValue
_ = forall a. Monoid a => a
mempty
walkCitationM :: (Walkable a [Inline], Monad m, Applicative m, Functor m)
=> (a -> m a) -> Citation -> m Citation
walkCitationM :: forall a (m :: * -> *).
(Walkable a [Inline], Monad m, Applicative m, Functor m) =>
(a -> m a) -> Citation -> m Citation
walkCitationM a -> m a
f (Citation Text
id' [Inline]
pref [Inline]
suff CitationMode
mode Int
notenum Int
hash) =
do [Inline]
pref' <- forall a b (m :: * -> *).
(Walkable a b, Monad m, Applicative m, Functor m) =>
(a -> m a) -> b -> m b
walkM a -> m a
f [Inline]
pref
[Inline]
suff' <- forall a b (m :: * -> *).
(Walkable a b, Monad m, Applicative m, Functor m) =>
(a -> m a) -> b -> m b
walkM a -> m a
f [Inline]
suff
forall (m :: * -> *) a. Monad m => a -> m a
return forall a b. (a -> b) -> a -> b
$ Text
-> [Inline] -> [Inline] -> CitationMode -> Int -> Int -> Citation
Citation Text
id' [Inline]
pref' [Inline]
suff' CitationMode
mode Int
notenum Int
hash
queryCitation :: (Walkable a [Inline], Monoid c)
=> (a -> c) -> Citation -> c
queryCitation :: forall a c.
(Walkable a [Inline], Monoid c) =>
(a -> c) -> Citation -> c
queryCitation a -> c
f (Citation Text
_ [Inline]
pref [Inline]
suff CitationMode
_ Int
_ Int
_) = forall a b c. (Walkable a b, Monoid c) => (a -> c) -> b -> c
query a -> c
f [Inline]
pref forall a. Semigroup a => a -> a -> a
<> forall a b c. (Walkable a b, Monoid c) => (a -> c) -> b -> c
query a -> c
f [Inline]
suff
walkRowM :: (Walkable a Cell, Monad m)
=> (a -> m a) -> Row -> m Row
walkRowM :: forall a (m :: * -> *).
(Walkable a Cell, Monad m) =>
(a -> m a) -> Row -> m Row
walkRowM a -> m a
f (Row Attr
attr [Cell]
bd) = Attr -> [Cell] -> Row
Row Attr
attr forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> forall a b (m :: * -> *).
(Walkable a b, Monad m, Applicative m, Functor m) =>
(a -> m a) -> b -> m b
walkM a -> m a
f [Cell]
bd
queryRow :: (Walkable a Cell, Monoid c)
=> (a -> c) -> Row -> c
queryRow :: forall a c. (Walkable a Cell, Monoid c) => (a -> c) -> Row -> c
queryRow a -> c
f (Row Attr
_ [Cell]
bd) = forall a b c. (Walkable a b, Monoid c) => (a -> c) -> b -> c
query a -> c
f [Cell]
bd
walkTableHeadM :: (Walkable a Row, Monad m)
=> (a -> m a) -> TableHead -> m TableHead
walkTableHeadM :: forall a (m :: * -> *).
(Walkable a Row, Monad m) =>
(a -> m a) -> TableHead -> m TableHead
walkTableHeadM a -> m a
f (TableHead Attr
attr [Row]
body) = Attr -> [Row] -> TableHead
TableHead Attr
attr forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> forall a b (m :: * -> *).
(Walkable a b, Monad m, Applicative m, Functor m) =>
(a -> m a) -> b -> m b
walkM a -> m a
f [Row]
body
queryTableHead :: (Walkable a Row, Monoid c)
=> (a -> c) -> TableHead -> c
queryTableHead :: forall a c.
(Walkable a Row, Monoid c) =>
(a -> c) -> TableHead -> c
queryTableHead a -> c
f (TableHead Attr
_ [Row]
body) = forall a b c. (Walkable a b, Monoid c) => (a -> c) -> b -> c
query a -> c
f [Row]
body
walkTableBodyM :: (Walkable a Row, Monad m)
=> (a -> m a) -> TableBody -> m TableBody
walkTableBodyM :: forall a (m :: * -> *).
(Walkable a Row, Monad m) =>
(a -> m a) -> TableBody -> m TableBody
walkTableBodyM a -> m a
f (TableBody Attr
attr RowHeadColumns
rhc [Row]
hd [Row]
bd) = Attr -> RowHeadColumns -> [Row] -> [Row] -> TableBody
TableBody Attr
attr RowHeadColumns
rhc forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> forall a b (m :: * -> *).
(Walkable a b, Monad m, Applicative m, Functor m) =>
(a -> m a) -> b -> m b
walkM a -> m a
f [Row]
hd forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> forall a b (m :: * -> *).
(Walkable a b, Monad m, Applicative m, Functor m) =>
(a -> m a) -> b -> m b
walkM a -> m a
f [Row]
bd
queryTableBody :: (Walkable a Row, Monoid c)
=> (a -> c) -> TableBody -> c
queryTableBody :: forall a c.
(Walkable a Row, Monoid c) =>
(a -> c) -> TableBody -> c
queryTableBody a -> c
f (TableBody Attr
_ RowHeadColumns
_ [Row]
hd [Row]
bd) = forall a b c. (Walkable a b, Monoid c) => (a -> c) -> b -> c
query a -> c
f [Row]
hd forall a. Semigroup a => a -> a -> a
<> forall a b c. (Walkable a b, Monoid c) => (a -> c) -> b -> c
query a -> c
f [Row]
bd
walkTableFootM :: (Walkable a Row, Monad m)
=> (a -> m a) -> TableFoot -> m TableFoot
a -> m a
f (TableFoot Attr
attr [Row]
body) = Attr -> [Row] -> TableFoot
TableFoot Attr
attr forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> forall a b (m :: * -> *).
(Walkable a b, Monad m, Applicative m, Functor m) =>
(a -> m a) -> b -> m b
walkM a -> m a
f [Row]
body
queryTableFoot :: (Walkable a Row, Monoid c)
=> (a -> c) -> TableFoot -> c
a -> c
f (TableFoot Attr
_ [Row]
body) = forall a b c. (Walkable a b, Monoid c) => (a -> c) -> b -> c
query a -> c
f [Row]
body
walkCellM :: (Walkable a [Block], Monad m)
=> (a -> m a) -> Cell -> m Cell
walkCellM :: forall a (m :: * -> *).
(Walkable a [Block], Monad m) =>
(a -> m a) -> Cell -> m Cell
walkCellM a -> m a
f (Cell Attr
attr Alignment
ma RowSpan
rs ColSpan
cs [Block]
content) = Attr -> Alignment -> RowSpan -> ColSpan -> [Block] -> Cell
Cell Attr
attr Alignment
ma RowSpan
rs ColSpan
cs forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> forall a b (m :: * -> *).
(Walkable a b, Monad m, Applicative m, Functor m) =>
(a -> m a) -> b -> m b
walkM a -> m a
f [Block]
content
queryCell :: (Walkable a [Block], Monoid c)
=> (a -> c) -> Cell -> c
queryCell :: forall a c. (Walkable a [Block], Monoid c) => (a -> c) -> Cell -> c
queryCell a -> c
f (Cell Attr
_ Alignment
_ RowSpan
_ ColSpan
_ [Block]
content) = forall a b c. (Walkable a b, Monoid c) => (a -> c) -> b -> c
query a -> c
f [Block]
content
walkCaptionM :: (Walkable a [Block], Walkable a [Inline], Monad m, Walkable a ShortCaption)
=> (a -> m a) -> Caption -> m Caption
walkCaptionM :: forall a (m :: * -> *).
(Walkable a [Block], Walkable a [Inline], Monad m,
Walkable a [Inline]) =>
(a -> m a) -> Caption -> m Caption
walkCaptionM a -> m a
f (Caption Maybe [Inline]
mshort [Block]
body) = Maybe [Inline] -> [Block] -> Caption
Caption forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> forall a b (m :: * -> *).
(Walkable a b, Monad m, Applicative m, Functor m) =>
(a -> m a) -> b -> m b
walkM a -> m a
f Maybe [Inline]
mshort forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> forall a b (m :: * -> *).
(Walkable a b, Monad m, Applicative m, Functor m) =>
(a -> m a) -> b -> m b
walkM a -> m a
f [Block]
body
queryCaption :: (Walkable a [Block], Walkable a [Inline], Walkable a ShortCaption, Monoid c)
=> (a -> c) -> Caption -> c
queryCaption :: forall a c.
(Walkable a [Block], Walkable a [Inline], Walkable a [Inline],
Monoid c) =>
(a -> c) -> Caption -> c
queryCaption a -> c
f (Caption Maybe [Inline]
mshort [Block]
body) = forall a b c. (Walkable a b, Monoid c) => (a -> c) -> b -> c
query a -> c
f Maybe [Inline]
mshort forall a. Semigroup a => a -> a -> a
<> forall a b c. (Walkable a b, Monoid c) => (a -> c) -> b -> c
query a -> c
f [Block]
body
walkPandocM :: (Walkable a Meta, Walkable a [Block], Monad m,
Applicative m, Functor m)
=> (a -> m a) -> Pandoc -> m Pandoc
walkPandocM :: forall a (m :: * -> *).
(Walkable a Meta, Walkable a [Block], Monad m, Applicative m,
Functor m) =>
(a -> m a) -> Pandoc -> m Pandoc
walkPandocM a -> m a
f (Pandoc Meta
m [Block]
bs) = do Meta
m' <- forall a b (m :: * -> *).
(Walkable a b, Monad m, Applicative m, Functor m) =>
(a -> m a) -> b -> m b
walkM a -> m a
f Meta
m
[Block]
bs' <- forall a b (m :: * -> *).
(Walkable a b, Monad m, Applicative m, Functor m) =>
(a -> m a) -> b -> m b
walkM a -> m a
f [Block]
bs
forall (m :: * -> *) a. Monad m => a -> m a
return forall a b. (a -> b) -> a -> b
$ Meta -> [Block] -> Pandoc
Pandoc Meta
m' [Block]
bs'
queryPandoc :: (Walkable a Meta, Walkable a [Block], Monoid c)
=> (a -> c) -> Pandoc -> c
queryPandoc :: forall a c.
(Walkable a Meta, Walkable a [Block], Monoid c) =>
(a -> c) -> Pandoc -> c
queryPandoc a -> c
f (Pandoc Meta
m [Block]
bs) = forall a b c. (Walkable a b, Monoid c) => (a -> c) -> b -> c
query a -> c
f Meta
m forall a. Semigroup a => a -> a -> a
<> forall a b c. (Walkable a b, Monoid c) => (a -> c) -> b -> c
query a -> c
f [Block]
bs