    {-# LANGUAGE DeriveTraversable #-}
    {-# LANGUAGE FlexibleContexts #-}
    {-# LANGUAGE FlexibleInstances #-}
    {-# LANGUAGE MultiParamTypeClasses #-}
    {- |
    Module      : Text.Pandoc.Lua.Walk
    Copyright   : © 2012–2020 John MacFarlane,
                  © 2017-2020 Albert Krewinkel
    License     : GNU GPL, version 2 or above
    Maintainer  : Albert Krewinkel <tarleb+pandoc@moltkeplatz.de>
    Stability   : alpha

    Walking documents in a filter-suitable way.
    -}
    module Text.Pandoc.Lua.Walk
      ( SingletonsList (..)
      )
    where

    import Control.Monad ((<=<))
    import Text.Pandoc.Definition
    import Text.Pandoc.Walk

    -- | Helper type which allows to traverse trees in order, while splicing in
    -- trees.
    --
    -- The only interesting use of this type is via it's '@Walkable@' instance. That
    -- instance makes it possible to walk a Pandoc document (or a subset thereof),
    -- while applying a function on each element of an AST element /list/, and have
    -- the resulting list spliced back in place of the original element. This is the
    -- traversal/splicing method used for Lua filters.
    newtype SingletonsList a = SingletonsList { SingletonsList a -> [a]
    singletonsList :: [a] }
      deriving (a -> SingletonsList b -> SingletonsList a
    (a -> b) -> SingletonsList a -> SingletonsList b
    (forall a b. (a -> b) -> SingletonsList a -> SingletonsList b)
    -> (forall a b. a -> SingletonsList b -> SingletonsList a)
    -> Functor SingletonsList
    forall a b. a -> SingletonsList b -> SingletonsList a
    forall a b. (a -> b) -> SingletonsList a -> SingletonsList b
    forall (f :: * -> *).
    (forall a b. (a -> b) -> f a -> f b)
    -> (forall a b. a -> f b -> f a) -> Functor f
    <$ :: a -> SingletonsList b -> SingletonsList a
    $c<$ :: forall a b. a -> SingletonsList b -> SingletonsList a
    fmap :: (a -> b) -> SingletonsList a -> SingletonsList b
    $cfmap :: forall a b. (a -> b) -> SingletonsList a -> SingletonsList b
    Functor, SingletonsList a -> Bool
    (a -> m) -> SingletonsList a -> m
    (a -> b -> b) -> b -> SingletonsList a -> b
    (forall m. Monoid m => SingletonsList m -> m)
    -> (forall m a. Monoid m => (a -> m) -> SingletonsList a -> m)
    -> (forall m a. Monoid m => (a -> m) -> SingletonsList a -> m)
    -> (forall a b. (a -> b -> b) -> b -> SingletonsList a -> b)
    -> (forall a b. (a -> b -> b) -> b -> SingletonsList a -> b)
    -> (forall b a. (b -> a -> b) -> b -> SingletonsList a -> b)
    -> (forall b a. (b -> a -> b) -> b -> SingletonsList a -> b)
    -> (forall a. (a -> a -> a) -> SingletonsList a -> a)
    -> (forall a. (a -> a -> a) -> SingletonsList a -> a)
    -> (forall a. SingletonsList a -> [a])
    -> (forall a. SingletonsList a -> Bool)
    -> (forall a. SingletonsList a -> Int)
    -> (forall a. Eq a => a -> SingletonsList a -> Bool)
    -> (forall a. Ord a => SingletonsList a -> a)
    -> (forall a. Ord a => SingletonsList a -> a)
    -> (forall a. Num a => SingletonsList a -> a)
    -> (forall a. Num a => SingletonsList a -> a)
    -> Foldable SingletonsList
    forall a. Eq a => a -> SingletonsList a -> Bool
    forall a. Num a => SingletonsList a -> a
    forall a. Ord a => SingletonsList a -> a
    forall m. Monoid m => SingletonsList m -> m
    forall a. SingletonsList a -> Bool
    forall a. SingletonsList a -> Int
    forall a. SingletonsList a -> [a]
    forall a. (a -> a -> a) -> SingletonsList a -> a
    forall m a. Monoid m => (a -> m) -> SingletonsList a -> m
    forall b a. (b -> a -> b) -> b -> SingletonsList a -> b
    forall a b. (a -> b -> b) -> b -> SingletonsList a -> b
    forall (t :: * -> *).
    (forall m. Monoid m => t m -> m)
    -> (forall m a. Monoid m => (a -> m) -> t a -> m)
    -> (forall m a. Monoid m => (a -> m) -> t a -> m)
    -> (forall a b. (a -> b -> b) -> b -> t a -> b)
    -> (forall a b. (a -> b -> b) -> b -> t a -> b)
    -> (forall b a. (b -> a -> b) -> b -> t a -> b)
    -> (forall b a. (b -> a -> b) -> b -> t a -> b)
    -> (forall a. (a -> a -> a) -> t a -> a)
    -> (forall a. (a -> a -> a) -> t a -> a)
    -> (forall a. t a -> [a])
    -> (forall a. t a -> Bool)
    -> (forall a. t a -> Int)
    -> (forall a. Eq a => a -> t a -> Bool)
    -> (forall a. Ord a => t a -> a)
    -> (forall a. Ord a => t a -> a)
    -> (forall a. Num a => t a -> a)
    -> (forall a. Num a => t a -> a)
    -> Foldable t
    product :: SingletonsList a -> a
    $cproduct :: forall a. Num a => SingletonsList a -> a
    sum :: SingletonsList a -> a
    $csum :: forall a. Num a => SingletonsList a -> a
    minimum :: SingletonsList a -> a
    $cminimum :: forall a. Ord a => SingletonsList a -> a
    maximum :: SingletonsList a -> a
    $cmaximum :: forall a. Ord a => SingletonsList a -> a
    elem :: a -> SingletonsList a -> Bool
    $celem :: forall a. Eq a => a -> SingletonsList a -> Bool
    length :: SingletonsList a -> Int
    $clength :: forall a. SingletonsList a -> Int
    null :: SingletonsList a -> Bool
    $cnull :: forall a. SingletonsList a -> Bool
    toList :: SingletonsList a -> [a]
    $ctoList :: forall a. SingletonsList a -> [a]
    foldl1 :: (a -> a -> a) -> SingletonsList a -> a
    $cfoldl1 :: forall a. (a -> a -> a) -> SingletonsList a -> a
    foldr1 :: (a -> a -> a) -> SingletonsList a -> a
    $cfoldr1 :: forall a. (a -> a -> a) -> SingletonsList a -> a
    foldl' :: (b -> a -> b) -> b -> SingletonsList a -> b
    $cfoldl' :: forall b a. (b -> a -> b) -> b -> SingletonsList a -> b
    foldl :: (b -> a -> b) -> b -> SingletonsList a -> b
    $cfoldl :: forall b a. (b -> a -> b) -> b -> SingletonsList a -> b
    foldr' :: (a -> b -> b) -> b -> SingletonsList a -> b
    $cfoldr' :: forall a b. (a -> b -> b) -> b -> SingletonsList a -> b
    foldr :: (a -> b -> b) -> b -> SingletonsList a -> b
    $cfoldr :: forall a b. (a -> b -> b) -> b -> SingletonsList a -> b
    foldMap' :: (a -> m) -> SingletonsList a -> m
    $cfoldMap' :: forall m a. Monoid m => (a -> m) -> SingletonsList a -> m
    foldMap :: (a -> m) -> SingletonsList a -> m
    $cfoldMap :: forall m a. Monoid m => (a -> m) -> SingletonsList a -> m
    fold :: SingletonsList m -> m
    $cfold :: forall m. Monoid m => SingletonsList m -> m
    Foldable, Functor SingletonsList
    Foldable SingletonsList
    (Functor SingletonsList, Foldable SingletonsList) =>
    (forall (f :: * -> *) a b.
     Applicative f =>
     (a -> f b) -> SingletonsList a -> f (SingletonsList b))
    -> (forall (f :: * -> *) a.
        Applicative f =>
        SingletonsList (f a) -> f (SingletonsList a))
    -> (forall (m :: * -> *) a b.
        Monad m =>
        (a -> m b) -> SingletonsList a -> m (SingletonsList b))
    -> (forall (m :: * -> *) a.
        Monad m =>
        SingletonsList (m a) -> m (SingletonsList a))
    -> Traversable SingletonsList
    (a -> f b) -> SingletonsList a -> f (SingletonsList b)
    forall (t :: * -> *).
    (Functor t, Foldable t) =>
    (forall (f :: * -> *) a b.
     Applicative f =>
     (a -> f b) -> t a -> f (t b))
    -> (forall (f :: * -> *) a. Applicative f => t (f a) -> f (t a))
    -> (forall (m :: * -> *) a b.
        Monad m =>
        (a -> m b) -> t a -> m (t b))
    -> (forall (m :: * -> *) a. Monad m => t (m a) -> m (t a))
    -> Traversable t
    forall (m :: * -> *) a.
    Monad m =>
    SingletonsList (m a) -> m (SingletonsList a)
    forall (f :: * -> *) a.
    Applicative f =>
    SingletonsList (f a) -> f (SingletonsList a)
    forall (m :: * -> *) a b.
    Monad m =>
    (a -> m b) -> SingletonsList a -> m (SingletonsList b)
    forall (f :: * -> *) a b.
    Applicative f =>
    (a -> f b) -> SingletonsList a -> f (SingletonsList b)
    sequence :: SingletonsList (m a) -> m (SingletonsList a)
    $csequence :: forall (m :: * -> *) a.
    Monad m =>
    SingletonsList (m a) -> m (SingletonsList a)
    mapM :: (a -> m b) -> SingletonsList a -> m (SingletonsList b)
    $cmapM :: forall (m :: * -> *) a b.
    Monad m =>
    (a -> m b) -> SingletonsList a -> m (SingletonsList b)
    sequenceA :: SingletonsList (f a) -> f (SingletonsList a)
    $csequenceA :: forall (f :: * -> *) a.
    Applicative f =>
    SingletonsList (f a) -> f (SingletonsList a)
    traverse :: (a -> f b) -> SingletonsList a -> f (SingletonsList b)
    $ctraverse :: forall (f :: * -> *) a b.
    Applicative f =>
    (a -> f b) -> SingletonsList a -> f (SingletonsList b)
    $cp2Traversable :: Foldable SingletonsList
    $cp1Traversable :: Functor SingletonsList
    Traversable)

    --
    -- SingletonsList Inline
    --
    instance {-# OVERLAPPING #-} Walkable (SingletonsList Inline) [Inline] where
      walkM :: (SingletonsList Inline -> m (SingletonsList Inline))
    -> [Inline] -> m [Inline]
    walkM = (SingletonsList Inline -> m (SingletonsList Inline))
    -> [Inline] -> m [Inline]
    forall (m :: * -> *) a.
    (Monad m, Walkable (SingletonsList a) a) =>
    (SingletonsList a -> m (SingletonsList a)) -> [a] -> m [a]
    walkSingletonsListM
      query :: (SingletonsList Inline -> c) -> [Inline] -> c
    query = (SingletonsList Inline -> c) -> [Inline] -> c
    forall c a.
    (Monoid c, Walkable (SingletonsList a) a) =>
    (SingletonsList a -> c) -> [a] -> c
    querySingletonsList

    instance Walkable (SingletonsList Inline) Pandoc where
      walkM :: (SingletonsList Inline -> m (SingletonsList Inline))
    -> Pandoc -> m Pandoc
    walkM = (SingletonsList Inline -> m (SingletonsList Inline))
    -> Pandoc -> m Pandoc
    forall a (m :: * -> *).
    (Walkable a Meta, Walkable a [Block], Monad m, Applicative m,
     Functor m) =>
    (a -> m a) -> Pandoc -> m Pandoc
    walkPandocM
      query :: (SingletonsList Inline -> c) -> Pandoc -> c
    query = (SingletonsList Inline -> c) -> Pandoc -> c
    forall a c.
    (Walkable a Meta, Walkable a [Block], Monoid c) =>
    (a -> c) -> Pandoc -> c
    queryPandoc

    instance Walkable (SingletonsList Inline) Citation where
      walkM :: (SingletonsList Inline -> m (SingletonsList Inline))
    -> Citation -> m Citation
    walkM = (SingletonsList Inline -> m (SingletonsList Inline))
    -> Citation -> m Citation
    forall a (m :: * -> *).
    (Walkable a [Inline], Monad m, Applicative m, Functor m) =>
    (a -> m a) -> Citation -> m Citation
    walkCitationM
      query :: (SingletonsList Inline -> c) -> Citation -> c
    query = (SingletonsList Inline -> c) -> Citation -> c
    forall a c.
    (Walkable a [Inline], Monoid c) =>
    (a -> c) -> Citation -> c
    queryCitation

    instance Walkable (SingletonsList Inline) Inline where
      walkM :: (SingletonsList Inline -> m (SingletonsList Inline))
    -> Inline -> m Inline
    walkM = (SingletonsList Inline -> m (SingletonsList Inline))
    -> Inline -> m Inline
    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 :: (SingletonsList Inline -> c) -> Inline -> c
    query = (SingletonsList Inline -> c) -> Inline -> c
    forall a c.
    (Walkable a Citation, Walkable a [Block], Walkable a [Inline],
     Monoid c) =>
    (a -> c) -> Inline -> c
    queryInline

    instance Walkable (SingletonsList Inline) Block where
      walkM :: (SingletonsList Inline -> m (SingletonsList Inline))
    -> Block -> m Block
    walkM = (SingletonsList Inline -> m (SingletonsList Inline))
    -> Block -> m Block
    forall a (m :: * -> *).
    (Walkable a [Block], Walkable a [Inline], Monad m, Applicative m,
     Functor m) =>
    (a -> m a) -> Block -> m Block
    walkBlockM
      query :: (SingletonsList Inline -> c) -> Block -> c
    query = (SingletonsList Inline -> c) -> Block -> c
    forall a c.
    (Walkable a Citation, Walkable a [Block], Walkable a [Inline],
     Monoid c) =>
    (a -> c) -> Block -> c
    queryBlock

    instance Walkable (SingletonsList Inline) MetaValue where
      walkM :: (SingletonsList Inline -> m (SingletonsList Inline))
    -> MetaValue -> m MetaValue
    walkM = (SingletonsList Inline -> m (SingletonsList Inline))
    -> MetaValue -> m MetaValue
    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 :: (SingletonsList Inline -> c) -> MetaValue -> c
    query = (SingletonsList Inline -> c) -> MetaValue -> c
    forall a c.
    (Walkable a MetaValue, Walkable a [Block], Walkable a [Inline],
     Monoid c) =>
    (a -> c) -> MetaValue -> c
    queryMetaValue

    instance Walkable (SingletonsList Inline) Meta where
      walkM :: (SingletonsList Inline -> m (SingletonsList Inline))
    -> Meta -> m Meta
    walkM f :: SingletonsList Inline -> m (SingletonsList Inline)
    f (Meta metamap :: Map Text MetaValue
    metamap) = Map Text MetaValue -> Meta
    Meta (Map Text MetaValue -> Meta) -> m (Map Text MetaValue) -> m Meta
    forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
    <$> (SingletonsList Inline -> m (SingletonsList Inline))
    -> Map Text MetaValue -> m (Map Text MetaValue)
    forall a b (m :: * -> *).
    (Walkable a b, Monad m, Applicative m, Functor m) =>
    (a -> m a) -> b -> m b
    walkM SingletonsList Inline -> m (SingletonsList Inline)
    f Map Text MetaValue
    metamap
      query :: (SingletonsList Inline -> c) -> Meta -> c
    query f :: SingletonsList Inline -> c
    f (Meta metamap :: Map Text MetaValue
    metamap) = (SingletonsList Inline -> c) -> Map Text MetaValue -> c
    forall a b c. (Walkable a b, Monoid c) => (a -> c) -> b -> c
    query SingletonsList Inline -> c
    f Map Text MetaValue
    metamap

    --
    -- SingletonsList Block
    --
    instance {-# OVERLAPPING #-} Walkable (SingletonsList Block) [Block] where
      walkM :: (SingletonsList Block -> m (SingletonsList Block))
    -> [Block] -> m [Block]
    walkM = (SingletonsList Block -> m (SingletonsList Block))
    -> [Block] -> m [Block]
    forall (m :: * -> *) a.
    (Monad m, Walkable (SingletonsList a) a) =>
    (SingletonsList a -> m (SingletonsList a)) -> [a] -> m [a]
    walkSingletonsListM
      query :: (SingletonsList Block -> c) -> [Block] -> c
    query = (SingletonsList Block -> c) -> [Block] -> c
    forall c a.
    (Monoid c, Walkable (SingletonsList a) a) =>
    (SingletonsList a -> c) -> [a] -> c
    querySingletonsList

    instance Walkable (SingletonsList Block) Pandoc where
      walkM :: (SingletonsList Block -> m (SingletonsList Block))
    -> Pandoc -> m Pandoc
    walkM = (SingletonsList Block -> m (SingletonsList Block))
    -> Pandoc -> m Pandoc
    forall a (m :: * -> *).
    (Walkable a Meta, Walkable a [Block], Monad m, Applicative m,
     Functor m) =>
    (a -> m a) -> Pandoc -> m Pandoc
    walkPandocM
      query :: (SingletonsList Block -> c) -> Pandoc -> c
    query = (SingletonsList Block -> c) -> Pandoc -> c
    forall a c.
    (Walkable a Meta, Walkable a [Block], Monoid c) =>
    (a -> c) -> Pandoc -> c
    queryPandoc

    instance Walkable (SingletonsList Block) Citation where
      walkM :: (SingletonsList Block -> m (SingletonsList Block))
    -> Citation -> m Citation
    walkM = (SingletonsList Block -> m (SingletonsList Block))
    -> Citation -> m Citation
    forall a (m :: * -> *).
    (Walkable a [Inline], Monad m, Applicative m, Functor m) =>
    (a -> m a) -> Citation -> m Citation
    walkCitationM
      query :: (SingletonsList Block -> c) -> Citation -> c
    query = (SingletonsList Block -> c) -> Citation -> c
    forall a c.
    (Walkable a [Inline], Monoid c) =>
    (a -> c) -> Citation -> c
    queryCitation

    instance Walkable (SingletonsList Block) Inline where
      walkM :: (SingletonsList Block -> m (SingletonsList Block))
    -> Inline -> m Inline
    walkM = (SingletonsList Block -> m (SingletonsList Block))
    -> Inline -> m Inline
    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 :: (SingletonsList Block -> c) -> Inline -> c
    query = (SingletonsList Block -> c) -> Inline -> c
    forall a c.
    (Walkable a Citation, Walkable a [Block], Walkable a [Inline],
     Monoid c) =>
    (a -> c) -> Inline -> c
    queryInline

    instance Walkable (SingletonsList Block) Block where
      walkM :: (SingletonsList Block -> m (SingletonsList Block))
    -> Block -> m Block
    walkM = (SingletonsList Block -> m (SingletonsList Block))
    -> Block -> m Block
    forall a (m :: * -> *).
    (Walkable a [Block], Walkable a [Inline], Monad m, Applicative m,
     Functor m) =>
    (a -> m a) -> Block -> m Block
    walkBlockM
      query :: (SingletonsList Block -> c) -> Block -> c
    query = (SingletonsList Block -> c) -> Block -> c
    forall a c.
    (Walkable a Citation, Walkable a [Block], Walkable a [Inline],
     Monoid c) =>
    (a -> c) -> Block -> c
    queryBlock

    instance Walkable (SingletonsList Block) MetaValue where
      walkM :: (SingletonsList Block -> m (SingletonsList Block))
    -> MetaValue -> m MetaValue
    walkM = (SingletonsList Block -> m (SingletonsList Block))
    -> MetaValue -> m MetaValue
    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 :: (SingletonsList Block -> c) -> MetaValue -> c
    query = (SingletonsList Block -> c) -> MetaValue -> c
    forall a c.
    (Walkable a MetaValue, Walkable a [Block], Walkable a [Inline],
     Monoid c) =>
    (a -> c) -> MetaValue -> c
    queryMetaValue

    instance Walkable (SingletonsList Block) Meta where
      walkM :: (SingletonsList Block -> m (SingletonsList Block))
    -> Meta -> m Meta
    walkM f :: SingletonsList Block -> m (SingletonsList Block)
    f (Meta metamap :: Map Text MetaValue
    metamap) = Map Text MetaValue -> Meta
    Meta (Map Text MetaValue -> Meta) -> m (Map Text MetaValue) -> m Meta
    forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
    <$> (SingletonsList Block -> m (SingletonsList Block))
    -> Map Text MetaValue -> m (Map Text MetaValue)
    forall a b (m :: * -> *).
    (Walkable a b, Monad m, Applicative m, Functor m) =>
    (a -> m a) -> b -> m b
    walkM SingletonsList Block -> m (SingletonsList Block)
    f Map Text MetaValue
    metamap
      query :: (SingletonsList Block -> c) -> Meta -> c
    query f :: SingletonsList Block -> c
    f (Meta metamap :: Map Text MetaValue
    metamap) = (SingletonsList Block -> c) -> Map Text MetaValue -> c
    forall a b c. (Walkable a b, Monoid c) => (a -> c) -> b -> c
    query SingletonsList Block -> c
    f Map Text MetaValue
    metamap

    walkSingletonsListM :: (Monad m, Walkable (SingletonsList a) a)
                        => (SingletonsList a -> m (SingletonsList a))
                        -> [a] -> m [a]
    walkSingletonsListM :: (SingletonsList a -> m (SingletonsList a)) -> [a] -> m [a]
    walkSingletonsListM f :: SingletonsList a -> m (SingletonsList a)
    f =
      let f' :: a -> m [a]
    f' = (SingletonsList a -> [a]) -> m (SingletonsList a) -> m [a]
    forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
    fmap SingletonsList a -> [a]
    forall a. SingletonsList a -> [a]
    singletonsList (m (SingletonsList a) -> m [a])
    -> (a -> m (SingletonsList a)) -> a -> m [a]
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . SingletonsList a -> m (SingletonsList a)
    f (SingletonsList a -> m (SingletonsList a))
    -> (a -> SingletonsList a) -> a -> m (SingletonsList a)
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . [a] -> SingletonsList a
    forall a. [a] -> SingletonsList a
    SingletonsList ([a] -> SingletonsList a) -> (a -> [a]) -> a -> SingletonsList a
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . (a -> [a] -> [a]
    forall a. a -> [a] -> [a]
    :[]) (a -> m [a]) -> (a -> m a) -> a -> m [a]
    forall (m :: * -> *) b c a.
    Monad m =>
    (b -> m c) -> (a -> m b) -> a -> m c
    <=< (SingletonsList a -> m (SingletonsList a)) -> a -> m a
    forall a b (m :: * -> *).
    (Walkable a b, Monad m, Applicative m, Functor m) =>
    (a -> m a) -> b -> m b
    walkM SingletonsList a -> m (SingletonsList a)
    f
      in ([[a]] -> [a]) -> m [[a]] -> m [a]
    forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
    fmap [[a]] -> [a]
    forall a. Monoid a => [a] -> a
    mconcat (m [[a]] -> m [a]) -> ([a] -> m [[a]]) -> [a] -> m [a]
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . (a -> m [a]) -> [a] -> m [[a]]
    forall (t :: * -> *) (m :: * -> *) a b.
    (Traversable t, Monad m) =>
    (a -> m b) -> t a -> m (t b)
    mapM a -> m [a]
    f'

    querySingletonsList :: (Monoid c, Walkable (SingletonsList a) a)
                        => (SingletonsList a -> c)
                        -> [a] -> c
    querySingletonsList :: (SingletonsList a -> c) -> [a] -> c
    querySingletonsList f :: SingletonsList a -> c
    f =
      let f' :: a -> c
    f' x :: a
    x = SingletonsList a -> c
    f ([a] -> SingletonsList a
    forall a. [a] -> SingletonsList a
    SingletonsList [a
    x]) c -> c -> c
    forall a. Monoid a => a -> a -> a
    `mappend` (SingletonsList a -> c) -> a -> c
    forall a b c. (Walkable a b, Monoid c) => (a -> c) -> b -> c
    query SingletonsList a -> c
    f a
    x
      in [c] -> c
    forall a. Monoid a => [a] -> a
    mconcat ([c] -> c) -> ([a] -> [c]) -> [a] -> c
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . (a -> c) -> [a] -> [c]
    forall a b. (a -> b) -> [a] -> [b]
    map a -> c
    f'