{-# LANGUAGE DeriveDataTypeable #-}
{-# LANGUAGE DeriveFoldable #-}
{-# LANGUAGE DeriveFunctor #-}
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE RecordWildCards #-}

-- |
-- Module      :  Text.MMark.Type
-- Copyright   :  © 2017–present Mark Karpov
-- License     :  BSD 3 clause
--
-- Maintainer  :  Mark Karpov <markkarpov92@gmail.com>
-- Stability   :  experimental
-- Portability :  portable
--
-- Internal type definitions. Some of these are re-exported in the public
-- modules.
module Text.MMark.Type
  ( MMark (..),
    Extension (..),
    Render (..),
    Bni,
    Block (..),
    CellAlign (..),
    Inline (..),
    Ois,
    mkOisInternal,
    getOis,
  )
where

import Control.DeepSeq
import Data.Aeson
import Data.Data (Data)
import Data.Function (on)
import Data.List.NonEmpty (NonEmpty (..))
import Data.Monoid hiding ((<>))
import Data.Text (Text)
import Data.Typeable (Typeable)
import GHC.Generics
import Lucid
import Text.URI (URI (..))

-- | Representation of complete markdown document. You can't look inside of
-- 'MMark' on purpose. The only way to influence an 'MMark' document you
-- obtain as a result of parsing is via the extension mechanism.
data MMark = MMark
  { -- | Parsed YAML document at the beginning (optional)
    MMark -> Maybe Value
mmarkYaml :: Maybe Value,
    -- | Actual contents of the document
    MMark -> [Bni]
mmarkBlocks :: [Bni],
    -- | Extension specifying how to process and render the blocks
    MMark -> Extension
mmarkExtension :: Extension
  }

instance NFData MMark where
  rnf :: MMark -> ()
rnf MMark {[Bni]
Maybe Value
Extension
mmarkExtension :: Extension
mmarkBlocks :: [Bni]
mmarkYaml :: Maybe Value
mmarkExtension :: MMark -> Extension
mmarkBlocks :: MMark -> [Bni]
mmarkYaml :: MMark -> Maybe Value
..} = Maybe Value -> ()
forall a. NFData a => a -> ()
rnf Maybe Value
mmarkYaml () -> () -> ()
`seq` [Bni] -> ()
forall a. NFData a => a -> ()
rnf [Bni]
mmarkBlocks

-- | Dummy instance.
--
-- @since 0.0.5.0
instance Show MMark where
  show :: MMark -> String
show = String -> MMark -> String
forall a b. a -> b -> a
const String
"MMark {..}"

-- | An extension. You can apply extensions with 'Text.MMark.useExtension'
-- and 'Text.MMark.useExtensions' functions. The "Text.MMark.Extension"
-- module provides tools for writing your own extensions.
--
-- Note that 'Extension' is an instance of 'Semigroup' and 'Monoid', i.e.
-- you can combine several extensions into one. Since the @('<>')@ operator
-- is right-associative and 'mconcat' is a right fold under the hood, the
-- expression
--
-- > l <> r
--
-- means that the extension @r@ will be applied before the extension @l@,
-- similar to how 'Endo' works. This may seem counter-intuitive, but only
-- with this logic we get consistency of ordering with more complex
-- expressions:
--
-- > e2 <> e1 <> e0 == e2 <> (e1 <> e0)
--
-- Here, @e0@ will be applied first, then @e1@, then @e2@. The same applies
-- to expressions involving 'mconcat'—extensions closer to beginning of the
-- list passed to 'mconcat' will be applied later.
data Extension = Extension
  { -- | Block transformation
    Extension -> Endo Bni
extBlockTrans :: Endo Bni,
    -- | Block render
    Extension -> Render (Block (Ois, Html ()))
extBlockRender :: Render (Block (Ois, Html ())),
    -- | Inline transformation
    Extension -> Endo Inline
extInlineTrans :: Endo Inline,
    -- | Inline render
    Extension -> Render Inline
extInlineRender :: Render Inline
  }

instance Semigroup Extension where
  Extension
x <> :: Extension -> Extension -> Extension
<> Extension
y =
    Extension :: Endo Bni
-> Render (Block (Ois, Html ()))
-> Endo Inline
-> Render Inline
-> Extension
Extension
      { extBlockTrans :: Endo Bni
extBlockTrans = (Endo Bni -> Endo Bni -> Endo Bni)
-> (Extension -> Endo Bni) -> Extension -> Extension -> Endo Bni
forall b c a. (b -> b -> c) -> (a -> b) -> a -> a -> c
on Endo Bni -> Endo Bni -> Endo Bni
forall a. Semigroup a => a -> a -> a
(<>) Extension -> Endo Bni
extBlockTrans Extension
x Extension
y,
        extBlockRender :: Render (Block (Ois, Html ()))
extBlockRender = (Render (Block (Ois, Html ()))
 -> Render (Block (Ois, Html ())) -> Render (Block (Ois, Html ())))
-> (Extension -> Render (Block (Ois, Html ())))
-> Extension
-> Extension
-> Render (Block (Ois, Html ()))
forall b c a. (b -> b -> c) -> (a -> b) -> a -> a -> c
on Render (Block (Ois, Html ()))
-> Render (Block (Ois, Html ())) -> Render (Block (Ois, Html ()))
forall a. Semigroup a => a -> a -> a
(<>) Extension -> Render (Block (Ois, Html ()))
extBlockRender Extension
x Extension
y,
        extInlineTrans :: Endo Inline
extInlineTrans = (Endo Inline -> Endo Inline -> Endo Inline)
-> (Extension -> Endo Inline)
-> Extension
-> Extension
-> Endo Inline
forall b c a. (b -> b -> c) -> (a -> b) -> a -> a -> c
on Endo Inline -> Endo Inline -> Endo Inline
forall a. Semigroup a => a -> a -> a
(<>) Extension -> Endo Inline
extInlineTrans Extension
x Extension
y,
        extInlineRender :: Render Inline
extInlineRender = (Render Inline -> Render Inline -> Render Inline)
-> (Extension -> Render Inline)
-> Extension
-> Extension
-> Render Inline
forall b c a. (b -> b -> c) -> (a -> b) -> a -> a -> c
on Render Inline -> Render Inline -> Render Inline
forall a. Semigroup a => a -> a -> a
(<>) Extension -> Render Inline
extInlineRender Extension
x Extension
y
      }

instance Monoid Extension where
  mempty :: Extension
mempty =
    Extension :: Endo Bni
-> Render (Block (Ois, Html ()))
-> Endo Inline
-> Render Inline
-> Extension
Extension
      { extBlockTrans :: Endo Bni
extBlockTrans = Endo Bni
forall a. Monoid a => a
mempty,
        extBlockRender :: Render (Block (Ois, Html ()))
extBlockRender = Render (Block (Ois, Html ()))
forall a. Monoid a => a
mempty,
        extInlineTrans :: Endo Inline
extInlineTrans = Endo Inline
forall a. Monoid a => a
mempty,
        extInlineRender :: Render Inline
extInlineRender = Render Inline
forall a. Monoid a => a
mempty
      }
  mappend :: Extension -> Extension -> Extension
mappend = Extension -> Extension -> Extension
forall a. Semigroup a => a -> a -> a
(<>)

-- | An internal type that captures the extensible rendering process we use.
-- 'Render' has a function inside which transforms a rendering function of
-- the type @a -> Html ()@.
newtype Render a = Render
  {Render a -> (a -> Html ()) -> a -> Html ()
runRender :: (a -> Html ()) -> a -> Html ()}

instance Semigroup (Render a) where
  Render (a -> Html ()) -> a -> Html ()
f <> :: Render a -> Render a -> Render a
<> Render (a -> Html ()) -> a -> Html ()
g = ((a -> Html ()) -> a -> Html ()) -> Render a
forall a. ((a -> Html ()) -> a -> Html ()) -> Render a
Render ((a -> Html ()) -> a -> Html ()
f ((a -> Html ()) -> a -> Html ())
-> ((a -> Html ()) -> a -> Html ())
-> (a -> Html ())
-> a
-> Html ()
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (a -> Html ()) -> a -> Html ()
g)

instance Monoid (Render a) where
  mempty :: Render a
mempty = ((a -> Html ()) -> a -> Html ()) -> Render a
forall a. ((a -> Html ()) -> a -> Html ()) -> Render a
Render (a -> Html ()) -> a -> Html ()
forall a. a -> a
id
  mappend :: Render a -> Render a -> Render a
mappend = Render a -> Render a -> Render a
forall a. Semigroup a => a -> a -> a
(<>)

-- | A shortcut for the frequently used type @'Block' ('NonEmpty'
-- 'Inline')@.
type Bni = Block (NonEmpty Inline)

-- | We can think of a markdown document as a collection of
-- blocks—structural elements like paragraphs, block quotations, lists,
-- headings, thematic breaks, and code blocks. Some blocks (like block
-- quotes and list items) contain other blocks; others (like headings and
-- paragraphs) contain inline content, see 'Inline'.
--
-- We can divide blocks into two types: container blocks, which can contain
-- other blocks, and leaf blocks, which cannot.
data Block a
  = -- | Thematic break, leaf block
    ThematicBreak
  | -- | Heading (level 1), leaf block
    Heading1 a
  | -- | Heading (level 2), leaf block
    Heading2 a
  | -- | Heading (level 3), leaf block
    Heading3 a
  | -- | Heading (level 4), leaf block
    Heading4 a
  | -- | Heading (level 5), leaf block
    Heading5 a
  | -- | Heading (level 6), leaf block
    Heading6 a
  | -- | Code block, leaf block with info string and contents
    CodeBlock (Maybe Text) Text
  | -- | Naked content, without an enclosing tag
    Naked a
  | -- | Paragraph, leaf block
    Paragraph a
  | -- | Blockquote container block
    Blockquote [Block a]
  | -- | Ordered list ('Word' is the start index), container block
    OrderedList Word (NonEmpty [Block a])
  | -- | Unordered list, container block
    UnorderedList (NonEmpty [Block a])
  | -- | Table, first argument is the alignment options, then we have a
    -- 'NonEmpty' list of rows, where every row is a 'NonEmpty' list of
    -- cells, where every cell is an @a@ thing.
    --
    -- The first row is always the header row, because pipe-tables that we
    -- support cannot lack a header row.
    --
    -- @since 0.0.4.0
    Table (NonEmpty CellAlign) (NonEmpty (NonEmpty a))
  deriving (Int -> Block a -> ShowS
[Block a] -> ShowS
Block a -> String
(Int -> Block a -> ShowS)
-> (Block a -> String) -> ([Block a] -> ShowS) -> Show (Block a)
forall a. Show a => Int -> Block a -> ShowS
forall a. Show a => [Block a] -> ShowS
forall a. Show a => Block a -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Block a] -> ShowS
$cshowList :: forall a. Show a => [Block a] -> ShowS
show :: Block a -> String
$cshow :: forall a. Show a => Block a -> String
showsPrec :: Int -> Block a -> ShowS
$cshowsPrec :: forall a. Show a => Int -> Block a -> ShowS
Show, Block a -> Block a -> Bool
(Block a -> Block a -> Bool)
-> (Block a -> Block a -> Bool) -> Eq (Block a)
forall a. Eq a => Block a -> Block a -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Block a -> Block a -> Bool
$c/= :: forall a. Eq a => Block a -> Block a -> Bool
== :: Block a -> Block a -> Bool
$c== :: forall a. Eq a => Block a -> Block a -> Bool
Eq, Eq (Block a)
Eq (Block a)
-> (Block a -> Block a -> Ordering)
-> (Block a -> Block a -> Bool)
-> (Block a -> Block a -> Bool)
-> (Block a -> Block a -> Bool)
-> (Block a -> Block a -> Bool)
-> (Block a -> Block a -> Block a)
-> (Block a -> Block a -> Block a)
-> Ord (Block a)
Block a -> Block a -> Bool
Block a -> Block a -> Ordering
Block a -> Block a -> Block a
forall a.
Eq a
-> (a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
forall a. Ord a => Eq (Block a)
forall a. Ord a => Block a -> Block a -> Bool
forall a. Ord a => Block a -> Block a -> Ordering
forall a. Ord a => Block a -> Block a -> Block a
min :: Block a -> Block a -> Block a
$cmin :: forall a. Ord a => Block a -> Block a -> Block a
max :: Block a -> Block a -> Block a
$cmax :: forall a. Ord a => Block a -> Block a -> Block a
>= :: Block a -> Block a -> Bool
$c>= :: forall a. Ord a => Block a -> Block a -> Bool
> :: Block a -> Block a -> Bool
$c> :: forall a. Ord a => Block a -> Block a -> Bool
<= :: Block a -> Block a -> Bool
$c<= :: forall a. Ord a => Block a -> Block a -> Bool
< :: Block a -> Block a -> Bool
$c< :: forall a. Ord a => Block a -> Block a -> Bool
compare :: Block a -> Block a -> Ordering
$ccompare :: forall a. Ord a => Block a -> Block a -> Ordering
$cp1Ord :: forall a. Ord a => Eq (Block a)
Ord, Typeable (Block a)
DataType
Constr
Typeable (Block a)
-> (forall (c :: * -> *).
    (forall d b. Data d => c (d -> b) -> d -> c b)
    -> (forall g. g -> c g) -> Block a -> c (Block a))
-> (forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c (Block a))
-> (Block a -> Constr)
-> (Block a -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c (Block a)))
-> (forall (t :: * -> * -> *) (c :: * -> *).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c (Block a)))
-> ((forall b. Data b => b -> b) -> Block a -> Block a)
-> (forall r r'.
    (r -> r' -> r)
    -> r -> (forall d. Data d => d -> r') -> Block a -> r)
-> (forall r r'.
    (r' -> r -> r)
    -> r -> (forall d. Data d => d -> r') -> Block a -> r)
-> (forall u. (forall d. Data d => d -> u) -> Block a -> [u])
-> (forall u. Int -> (forall d. Data d => d -> u) -> Block a -> u)
-> (forall (m :: * -> *).
    Monad m =>
    (forall d. Data d => d -> m d) -> Block a -> m (Block a))
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> Block a -> m (Block a))
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> Block a -> m (Block a))
-> Data (Block a)
Block a -> DataType
Block a -> Constr
(forall d. Data d => c (t d)) -> Maybe (c (Block a))
(forall b. Data b => b -> b) -> Block a -> Block a
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Block a -> c (Block a)
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c (Block a)
forall a. Data a => Typeable (Block a)
forall a. Data a => Block a -> DataType
forall a. Data a => Block a -> Constr
forall a.
Data a =>
(forall b. Data b => b -> b) -> Block a -> Block a
forall a u.
Data a =>
Int -> (forall d. Data d => d -> u) -> Block a -> u
forall a u.
Data a =>
(forall d. Data d => d -> u) -> Block a -> [u]
forall a r r'.
Data a =>
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> Block a -> r
forall a r r'.
Data a =>
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> Block a -> r
forall a (m :: * -> *).
(Data a, Monad m) =>
(forall d. Data d => d -> m d) -> Block a -> m (Block a)
forall a (m :: * -> *).
(Data a, MonadPlus m) =>
(forall d. Data d => d -> m d) -> Block a -> m (Block a)
forall a (c :: * -> *).
Data a =>
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c (Block a)
forall a (c :: * -> *).
Data a =>
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Block a -> c (Block a)
forall a (t :: * -> *) (c :: * -> *).
(Data a, Typeable t) =>
(forall d. Data d => c (t d)) -> Maybe (c (Block a))
forall a (t :: * -> * -> *) (c :: * -> *).
(Data a, Typeable t) =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c (Block a))
forall a.
Typeable a
-> (forall (c :: * -> *).
    (forall d b. Data d => c (d -> b) -> d -> c b)
    -> (forall g. g -> c g) -> a -> c a)
-> (forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c a)
-> (a -> Constr)
-> (a -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c a))
-> (forall (t :: * -> * -> *) (c :: * -> *).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c a))
-> ((forall b. Data b => b -> b) -> a -> a)
-> (forall r r'.
    (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall r r'.
    (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall u. (forall d. Data d => d -> u) -> a -> [u])
-> (forall u. Int -> (forall d. Data d => d -> u) -> a -> u)
-> (forall (m :: * -> *).
    Monad m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> Data a
forall u. Int -> (forall d. Data d => d -> u) -> Block a -> u
forall u. (forall d. Data d => d -> u) -> Block a -> [u]
forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> Block a -> r
forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> Block a -> r
forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> Block a -> m (Block a)
forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> Block a -> m (Block a)
forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c (Block a)
forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Block a -> c (Block a)
forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c (Block a))
forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c (Block a))
$cTable :: Constr
$cUnorderedList :: Constr
$cOrderedList :: Constr
$cBlockquote :: Constr
$cParagraph :: Constr
$cNaked :: Constr
$cCodeBlock :: Constr
$cHeading6 :: Constr
$cHeading5 :: Constr
$cHeading4 :: Constr
$cHeading3 :: Constr
$cHeading2 :: Constr
$cHeading1 :: Constr
$cThematicBreak :: Constr
$tBlock :: DataType
gmapMo :: (forall d. Data d => d -> m d) -> Block a -> m (Block a)
$cgmapMo :: forall a (m :: * -> *).
(Data a, MonadPlus m) =>
(forall d. Data d => d -> m d) -> Block a -> m (Block a)
gmapMp :: (forall d. Data d => d -> m d) -> Block a -> m (Block a)
$cgmapMp :: forall a (m :: * -> *).
(Data a, MonadPlus m) =>
(forall d. Data d => d -> m d) -> Block a -> m (Block a)
gmapM :: (forall d. Data d => d -> m d) -> Block a -> m (Block a)
$cgmapM :: forall a (m :: * -> *).
(Data a, Monad m) =>
(forall d. Data d => d -> m d) -> Block a -> m (Block a)
gmapQi :: Int -> (forall d. Data d => d -> u) -> Block a -> u
$cgmapQi :: forall a u.
Data a =>
Int -> (forall d. Data d => d -> u) -> Block a -> u
gmapQ :: (forall d. Data d => d -> u) -> Block a -> [u]
$cgmapQ :: forall a u.
Data a =>
(forall d. Data d => d -> u) -> Block a -> [u]
gmapQr :: (r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> Block a -> r
$cgmapQr :: forall a r r'.
Data a =>
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> Block a -> r
gmapQl :: (r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> Block a -> r
$cgmapQl :: forall a r r'.
Data a =>
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> Block a -> r
gmapT :: (forall b. Data b => b -> b) -> Block a -> Block a
$cgmapT :: forall a.
Data a =>
(forall b. Data b => b -> b) -> Block a -> Block a
dataCast2 :: (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c (Block a))
$cdataCast2 :: forall a (t :: * -> * -> *) (c :: * -> *).
(Data a, Typeable t) =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c (Block a))
dataCast1 :: (forall d. Data d => c (t d)) -> Maybe (c (Block a))
$cdataCast1 :: forall a (t :: * -> *) (c :: * -> *).
(Data a, Typeable t) =>
(forall d. Data d => c (t d)) -> Maybe (c (Block a))
dataTypeOf :: Block a -> DataType
$cdataTypeOf :: forall a. Data a => Block a -> DataType
toConstr :: Block a -> Constr
$ctoConstr :: forall a. Data a => Block a -> Constr
gunfold :: (forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c (Block a)
$cgunfold :: forall a (c :: * -> *).
Data a =>
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c (Block a)
gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Block a -> c (Block a)
$cgfoldl :: forall a (c :: * -> *).
Data a =>
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Block a -> c (Block a)
$cp1Data :: forall a. Data a => Typeable (Block a)
Data, Typeable, (forall x. Block a -> Rep (Block a) x)
-> (forall x. Rep (Block a) x -> Block a) -> Generic (Block a)
forall x. Rep (Block a) x -> Block a
forall x. Block a -> Rep (Block a) x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
forall a x. Rep (Block a) x -> Block a
forall a x. Block a -> Rep (Block a) x
$cto :: forall a x. Rep (Block a) x -> Block a
$cfrom :: forall a x. Block a -> Rep (Block a) x
Generic, a -> Block b -> Block a
(a -> b) -> Block a -> Block b
(forall a b. (a -> b) -> Block a -> Block b)
-> (forall a b. a -> Block b -> Block a) -> Functor Block
forall a b. a -> Block b -> Block a
forall a b. (a -> b) -> Block a -> Block b
forall (f :: * -> *).
(forall a b. (a -> b) -> f a -> f b)
-> (forall a b. a -> f b -> f a) -> Functor f
<$ :: a -> Block b -> Block a
$c<$ :: forall a b. a -> Block b -> Block a
fmap :: (a -> b) -> Block a -> Block b
$cfmap :: forall a b. (a -> b) -> Block a -> Block b
Functor, Block a -> Bool
(a -> m) -> Block a -> m
(a -> b -> b) -> b -> Block a -> b
(forall m. Monoid m => Block m -> m)
-> (forall m a. Monoid m => (a -> m) -> Block a -> m)
-> (forall m a. Monoid m => (a -> m) -> Block a -> m)
-> (forall a b. (a -> b -> b) -> b -> Block a -> b)
-> (forall a b. (a -> b -> b) -> b -> Block a -> b)
-> (forall b a. (b -> a -> b) -> b -> Block a -> b)
-> (forall b a. (b -> a -> b) -> b -> Block a -> b)
-> (forall a. (a -> a -> a) -> Block a -> a)
-> (forall a. (a -> a -> a) -> Block a -> a)
-> (forall a. Block a -> [a])
-> (forall a. Block a -> Bool)
-> (forall a. Block a -> Int)
-> (forall a. Eq a => a -> Block a -> Bool)
-> (forall a. Ord a => Block a -> a)
-> (forall a. Ord a => Block a -> a)
-> (forall a. Num a => Block a -> a)
-> (forall a. Num a => Block a -> a)
-> Foldable Block
forall a. Eq a => a -> Block a -> Bool
forall a. Num a => Block a -> a
forall a. Ord a => Block a -> a
forall m. Monoid m => Block m -> m
forall a. Block a -> Bool
forall a. Block a -> Int
forall a. Block a -> [a]
forall a. (a -> a -> a) -> Block a -> a
forall m a. Monoid m => (a -> m) -> Block a -> m
forall b a. (b -> a -> b) -> b -> Block a -> b
forall a b. (a -> b -> b) -> b -> Block 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 :: Block a -> a
$cproduct :: forall a. Num a => Block a -> a
sum :: Block a -> a
$csum :: forall a. Num a => Block a -> a
minimum :: Block a -> a
$cminimum :: forall a. Ord a => Block a -> a
maximum :: Block a -> a
$cmaximum :: forall a. Ord a => Block a -> a
elem :: a -> Block a -> Bool
$celem :: forall a. Eq a => a -> Block a -> Bool
length :: Block a -> Int
$clength :: forall a. Block a -> Int
null :: Block a -> Bool
$cnull :: forall a. Block a -> Bool
toList :: Block a -> [a]
$ctoList :: forall a. Block a -> [a]
foldl1 :: (a -> a -> a) -> Block a -> a
$cfoldl1 :: forall a. (a -> a -> a) -> Block a -> a
foldr1 :: (a -> a -> a) -> Block a -> a
$cfoldr1 :: forall a. (a -> a -> a) -> Block a -> a
foldl' :: (b -> a -> b) -> b -> Block a -> b
$cfoldl' :: forall b a. (b -> a -> b) -> b -> Block a -> b
foldl :: (b -> a -> b) -> b -> Block a -> b
$cfoldl :: forall b a. (b -> a -> b) -> b -> Block a -> b
foldr' :: (a -> b -> b) -> b -> Block a -> b
$cfoldr' :: forall a b. (a -> b -> b) -> b -> Block a -> b
foldr :: (a -> b -> b) -> b -> Block a -> b
$cfoldr :: forall a b. (a -> b -> b) -> b -> Block a -> b
foldMap' :: (a -> m) -> Block a -> m
$cfoldMap' :: forall m a. Monoid m => (a -> m) -> Block a -> m
foldMap :: (a -> m) -> Block a -> m
$cfoldMap :: forall m a. Monoid m => (a -> m) -> Block a -> m
fold :: Block m -> m
$cfold :: forall m. Monoid m => Block m -> m
Foldable)

instance NFData a => NFData (Block a)

-- | Options for cell alignment in tables.
--
-- @since 0.0.4.0
data CellAlign
  = -- | No specific alignment specified
    CellAlignDefault
  | -- | Left-alignment
    CellAlignLeft
  | -- | Right-alignment
    CellAlignRight
  | -- | Center-alignment
    CellAlignCenter
  deriving (Int -> CellAlign -> ShowS
[CellAlign] -> ShowS
CellAlign -> String
(Int -> CellAlign -> ShowS)
-> (CellAlign -> String)
-> ([CellAlign] -> ShowS)
-> Show CellAlign
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CellAlign] -> ShowS
$cshowList :: [CellAlign] -> ShowS
show :: CellAlign -> String
$cshow :: CellAlign -> String
showsPrec :: Int -> CellAlign -> ShowS
$cshowsPrec :: Int -> CellAlign -> ShowS
Show, CellAlign -> CellAlign -> Bool
(CellAlign -> CellAlign -> Bool)
-> (CellAlign -> CellAlign -> Bool) -> Eq CellAlign
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CellAlign -> CellAlign -> Bool
$c/= :: CellAlign -> CellAlign -> Bool
== :: CellAlign -> CellAlign -> Bool
$c== :: CellAlign -> CellAlign -> Bool
Eq, Eq CellAlign
Eq CellAlign
-> (CellAlign -> CellAlign -> Ordering)
-> (CellAlign -> CellAlign -> Bool)
-> (CellAlign -> CellAlign -> Bool)
-> (CellAlign -> CellAlign -> Bool)
-> (CellAlign -> CellAlign -> Bool)
-> (CellAlign -> CellAlign -> CellAlign)
-> (CellAlign -> CellAlign -> CellAlign)
-> Ord CellAlign
CellAlign -> CellAlign -> Bool
CellAlign -> CellAlign -> Ordering
CellAlign -> CellAlign -> CellAlign
forall a.
Eq a
-> (a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
min :: CellAlign -> CellAlign -> CellAlign
$cmin :: CellAlign -> CellAlign -> CellAlign
max :: CellAlign -> CellAlign -> CellAlign
$cmax :: CellAlign -> CellAlign -> CellAlign
>= :: CellAlign -> CellAlign -> Bool
$c>= :: CellAlign -> CellAlign -> Bool
> :: CellAlign -> CellAlign -> Bool
$c> :: CellAlign -> CellAlign -> Bool
<= :: CellAlign -> CellAlign -> Bool
$c<= :: CellAlign -> CellAlign -> Bool
< :: CellAlign -> CellAlign -> Bool
$c< :: CellAlign -> CellAlign -> Bool
compare :: CellAlign -> CellAlign -> Ordering
$ccompare :: CellAlign -> CellAlign -> Ordering
$cp1Ord :: Eq CellAlign
Ord, Typeable CellAlign
DataType
Constr
Typeable CellAlign
-> (forall (c :: * -> *).
    (forall d b. Data d => c (d -> b) -> d -> c b)
    -> (forall g. g -> c g) -> CellAlign -> c CellAlign)
-> (forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c CellAlign)
-> (CellAlign -> Constr)
-> (CellAlign -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c CellAlign))
-> (forall (t :: * -> * -> *) (c :: * -> *).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c CellAlign))
-> ((forall b. Data b => b -> b) -> CellAlign -> CellAlign)
-> (forall r r'.
    (r -> r' -> r)
    -> r -> (forall d. Data d => d -> r') -> CellAlign -> r)
-> (forall r r'.
    (r' -> r -> r)
    -> r -> (forall d. Data d => d -> r') -> CellAlign -> r)
-> (forall u. (forall d. Data d => d -> u) -> CellAlign -> [u])
-> (forall u.
    Int -> (forall d. Data d => d -> u) -> CellAlign -> u)
-> (forall (m :: * -> *).
    Monad m =>
    (forall d. Data d => d -> m d) -> CellAlign -> m CellAlign)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> CellAlign -> m CellAlign)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> CellAlign -> m CellAlign)
-> Data CellAlign
CellAlign -> DataType
CellAlign -> Constr
(forall b. Data b => b -> b) -> CellAlign -> CellAlign
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> CellAlign -> c CellAlign
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c CellAlign
forall a.
Typeable a
-> (forall (c :: * -> *).
    (forall d b. Data d => c (d -> b) -> d -> c b)
    -> (forall g. g -> c g) -> a -> c a)
-> (forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c a)
-> (a -> Constr)
-> (a -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c a))
-> (forall (t :: * -> * -> *) (c :: * -> *).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c a))
-> ((forall b. Data b => b -> b) -> a -> a)
-> (forall r r'.
    (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall r r'.
    (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall u. (forall d. Data d => d -> u) -> a -> [u])
-> (forall u. Int -> (forall d. Data d => d -> u) -> a -> u)
-> (forall (m :: * -> *).
    Monad m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> Data a
forall u. Int -> (forall d. Data d => d -> u) -> CellAlign -> u
forall u. (forall d. Data d => d -> u) -> CellAlign -> [u]
forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> CellAlign -> r
forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> CellAlign -> r
forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> CellAlign -> m CellAlign
forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> CellAlign -> m CellAlign
forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c CellAlign
forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> CellAlign -> c CellAlign
forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c CellAlign)
forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c CellAlign)
$cCellAlignCenter :: Constr
$cCellAlignRight :: Constr
$cCellAlignLeft :: Constr
$cCellAlignDefault :: Constr
$tCellAlign :: DataType
gmapMo :: (forall d. Data d => d -> m d) -> CellAlign -> m CellAlign
$cgmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> CellAlign -> m CellAlign
gmapMp :: (forall d. Data d => d -> m d) -> CellAlign -> m CellAlign
$cgmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> CellAlign -> m CellAlign
gmapM :: (forall d. Data d => d -> m d) -> CellAlign -> m CellAlign
$cgmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> CellAlign -> m CellAlign
gmapQi :: Int -> (forall d. Data d => d -> u) -> CellAlign -> u
$cgmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> CellAlign -> u
gmapQ :: (forall d. Data d => d -> u) -> CellAlign -> [u]
$cgmapQ :: forall u. (forall d. Data d => d -> u) -> CellAlign -> [u]
gmapQr :: (r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> CellAlign -> r
$cgmapQr :: forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> CellAlign -> r
gmapQl :: (r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> CellAlign -> r
$cgmapQl :: forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> CellAlign -> r
gmapT :: (forall b. Data b => b -> b) -> CellAlign -> CellAlign
$cgmapT :: (forall b. Data b => b -> b) -> CellAlign -> CellAlign
dataCast2 :: (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c CellAlign)
$cdataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c CellAlign)
dataCast1 :: (forall d. Data d => c (t d)) -> Maybe (c CellAlign)
$cdataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c CellAlign)
dataTypeOf :: CellAlign -> DataType
$cdataTypeOf :: CellAlign -> DataType
toConstr :: CellAlign -> Constr
$ctoConstr :: CellAlign -> Constr
gunfold :: (forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c CellAlign
$cgunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c CellAlign
gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> CellAlign -> c CellAlign
$cgfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> CellAlign -> c CellAlign
$cp1Data :: Typeable CellAlign
Data, Typeable, (forall x. CellAlign -> Rep CellAlign x)
-> (forall x. Rep CellAlign x -> CellAlign) -> Generic CellAlign
forall x. Rep CellAlign x -> CellAlign
forall x. CellAlign -> Rep CellAlign x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CellAlign x -> CellAlign
$cfrom :: forall x. CellAlign -> Rep CellAlign x
Generic)

instance NFData CellAlign

-- | Inline markdown content.
data Inline
  = -- | Plain text
    Plain Text
  | -- | Line break (hard)
    LineBreak
  | -- | Emphasis
    Emphasis (NonEmpty Inline)
  | -- | Strong emphasis
    Strong (NonEmpty Inline)
  | -- | Strikeout
    Strikeout (NonEmpty Inline)
  | -- | Subscript
    Subscript (NonEmpty Inline)
  | -- | Superscript
    Superscript (NonEmpty Inline)
  | -- | Code span
    CodeSpan Text
  | -- | Link with text, destination, and optionally title
    Link (NonEmpty Inline) URI (Maybe Text)
  | -- | Image with description, URL, and optionally title
    Image (NonEmpty Inline) URI (Maybe Text)
  deriving (Int -> Inline -> ShowS
[Inline] -> ShowS
Inline -> String
(Int -> Inline -> ShowS)
-> (Inline -> String) -> ([Inline] -> ShowS) -> Show Inline
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Inline] -> ShowS
$cshowList :: [Inline] -> ShowS
show :: Inline -> String
$cshow :: Inline -> String
showsPrec :: Int -> Inline -> ShowS
$cshowsPrec :: Int -> Inline -> ShowS
Show, Inline -> Inline -> Bool
(Inline -> Inline -> Bool)
-> (Inline -> Inline -> Bool) -> Eq Inline
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Inline -> Inline -> Bool
$c/= :: Inline -> Inline -> Bool
== :: Inline -> Inline -> Bool
$c== :: Inline -> Inline -> Bool
Eq, Eq Inline
Eq Inline
-> (Inline -> Inline -> Ordering)
-> (Inline -> Inline -> Bool)
-> (Inline -> Inline -> Bool)
-> (Inline -> Inline -> Bool)
-> (Inline -> Inline -> Bool)
-> (Inline -> Inline -> Inline)
-> (Inline -> Inline -> Inline)
-> Ord Inline
Inline -> Inline -> Bool
Inline -> Inline -> Ordering
Inline -> Inline -> Inline
forall a.
Eq a
-> (a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
min :: Inline -> Inline -> Inline
$cmin :: Inline -> Inline -> Inline
max :: Inline -> Inline -> Inline
$cmax :: Inline -> Inline -> Inline
>= :: Inline -> Inline -> Bool
$c>= :: Inline -> Inline -> Bool
> :: Inline -> Inline -> Bool
$c> :: Inline -> Inline -> Bool
<= :: Inline -> Inline -> Bool
$c<= :: Inline -> Inline -> Bool
< :: Inline -> Inline -> Bool
$c< :: Inline -> Inline -> Bool
compare :: Inline -> Inline -> Ordering
$ccompare :: Inline -> Inline -> Ordering
$cp1Ord :: Eq Inline
Ord, Typeable Inline
DataType
Constr
Typeable Inline
-> (forall (c :: * -> *).
    (forall d b. Data d => c (d -> b) -> d -> c b)
    -> (forall g. g -> c g) -> Inline -> c Inline)
-> (forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c Inline)
-> (Inline -> Constr)
-> (Inline -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c Inline))
-> (forall (t :: * -> * -> *) (c :: * -> *).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Inline))
-> ((forall b. Data b => b -> b) -> Inline -> Inline)
-> (forall r r'.
    (r -> r' -> r)
    -> r -> (forall d. Data d => d -> r') -> Inline -> r)
-> (forall r r'.
    (r' -> r -> r)
    -> r -> (forall d. Data d => d -> r') -> Inline -> r)
-> (forall u. (forall d. Data d => d -> u) -> Inline -> [u])
-> (forall u. Int -> (forall d. Data d => d -> u) -> Inline -> u)
-> (forall (m :: * -> *).
    Monad m =>
    (forall d. Data d => d -> m d) -> Inline -> m Inline)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> Inline -> m Inline)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> Inline -> m Inline)
-> Data Inline
Inline -> DataType
Inline -> Constr
(forall b. Data b => b -> b) -> Inline -> Inline
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Inline -> c Inline
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c Inline
forall a.
Typeable a
-> (forall (c :: * -> *).
    (forall d b. Data d => c (d -> b) -> d -> c b)
    -> (forall g. g -> c g) -> a -> c a)
-> (forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c a)
-> (a -> Constr)
-> (a -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c a))
-> (forall (t :: * -> * -> *) (c :: * -> *).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c a))
-> ((forall b. Data b => b -> b) -> a -> a)
-> (forall r r'.
    (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall r r'.
    (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall u. (forall d. Data d => d -> u) -> a -> [u])
-> (forall u. Int -> (forall d. Data d => d -> u) -> a -> u)
-> (forall (m :: * -> *).
    Monad m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> Data a
forall u. Int -> (forall d. Data d => d -> u) -> Inline -> u
forall u. (forall d. Data d => d -> u) -> Inline -> [u]
forall r r'.
(r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Inline -> r
forall r r'.
(r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Inline -> r
forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> Inline -> m Inline
forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> Inline -> m Inline
forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c Inline
forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Inline -> c Inline
forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c Inline)
forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Inline)
$cImage :: Constr
$cLink :: Constr
$cCodeSpan :: Constr
$cSuperscript :: Constr
$cSubscript :: Constr
$cStrikeout :: Constr
$cStrong :: Constr
$cEmphasis :: Constr
$cLineBreak :: Constr
$cPlain :: Constr
$tInline :: DataType
gmapMo :: (forall d. Data d => d -> m d) -> Inline -> m Inline
$cgmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> Inline -> m Inline
gmapMp :: (forall d. Data d => d -> m d) -> Inline -> m Inline
$cgmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> Inline -> m Inline
gmapM :: (forall d. Data d => d -> m d) -> Inline -> m Inline
$cgmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> Inline -> m Inline
gmapQi :: Int -> (forall d. Data d => d -> u) -> Inline -> u
$cgmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> Inline -> u
gmapQ :: (forall d. Data d => d -> u) -> Inline -> [u]
$cgmapQ :: forall u. (forall d. Data d => d -> u) -> Inline -> [u]
gmapQr :: (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Inline -> r
$cgmapQr :: forall r r'.
(r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Inline -> r
gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Inline -> r
$cgmapQl :: forall r r'.
(r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Inline -> r
gmapT :: (forall b. Data b => b -> b) -> Inline -> Inline
$cgmapT :: (forall b. Data b => b -> b) -> Inline -> Inline
dataCast2 :: (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Inline)
$cdataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Inline)
dataCast1 :: (forall d. Data d => c (t d)) -> Maybe (c Inline)
$cdataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c Inline)
dataTypeOf :: Inline -> DataType
$cdataTypeOf :: Inline -> DataType
toConstr :: Inline -> Constr
$ctoConstr :: Inline -> Constr
gunfold :: (forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c Inline
$cgunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c Inline
gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Inline -> c Inline
$cgfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Inline -> c Inline
$cp1Data :: Typeable Inline
Data, Typeable, (forall x. Inline -> Rep Inline x)
-> (forall x. Rep Inline x -> Inline) -> Generic Inline
forall x. Rep Inline x -> Inline
forall x. Inline -> Rep Inline x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep Inline x -> Inline
$cfrom :: forall x. Inline -> Rep Inline x
Generic)

instance NFData Inline

-- | A wrapper for “original inlines”. Source inlines are wrapped in this
-- during rendering of inline components and then it's available to block
-- render, but only for inspection. Altering of 'Ois' is not possible
-- because the user cannot construct a value of the 'Ois' type, he\/she can
-- only inspect it with 'getOis'.
newtype Ois = Ois (NonEmpty Inline)

-- | Make an 'Ois' value. This is an internal constructor that should not be
-- exposed!
mkOisInternal :: NonEmpty Inline -> Ois
mkOisInternal :: NonEmpty Inline -> Ois
mkOisInternal = NonEmpty Inline -> Ois
Ois

-- | Project @'NonEmpty' 'Inline'@ from 'Ois'.
getOis :: Ois -> NonEmpty Inline
getOis :: Ois -> NonEmpty Inline
getOis (Ois NonEmpty Inline
inlines) = NonEmpty Inline
inlines