{-# LANGUAGE DeriveDataTypeable         #-}
{-# LANGUAGE FunctionalDependencies     #-}
{-# LANGUAGE OverloadedStrings          #-}
{-# LANGUAGE MonoLocalBinds             #-}

module Commonmark.Types
  ( Format(..)
  , ListSpacing(..)
  , ListType(..)
  , DelimiterType(..)
  , EnumeratorType(..)
  , IsInline(..)
  , IsBlock(..)
  , SourceRange(..)
  , Rangeable(..)
  , Attribute
  , Attributes
  , HasAttributes(..)
  , ToPlainText(..)

  -- * Re-exports
  , module Text.Parsec.Pos
  )
where
import           Data.Data            (Data)
import           Data.Text            (Text)
import qualified Data.Text            as T
import           Data.Typeable        (Typeable)
import           Text.Parsec.Pos      (SourcePos, sourceColumn, sourceLine,
                                       sourceName)

newtype Format = Format Text
  deriving (Int -> Format -> ShowS
[Format] -> ShowS
Format -> String
(Int -> Format -> ShowS)
-> (Format -> String) -> ([Format] -> ShowS) -> Show Format
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> Format -> ShowS
showsPrec :: Int -> Format -> ShowS
$cshow :: Format -> String
show :: Format -> String
$cshowList :: [Format] -> ShowS
showList :: [Format] -> ShowS
Show, Typeable Format
Typeable Format =>
(forall (c :: * -> *).
 (forall d b. Data d => c (d -> b) -> d -> c b)
 -> (forall g. g -> c g) -> Format -> c Format)
-> (forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c Format)
-> (Format -> Constr)
-> (Format -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c Format))
-> (forall (t :: * -> * -> *) (c :: * -> *).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Format))
-> ((forall b. Data b => b -> b) -> Format -> Format)
-> (forall r r'.
    (r -> r' -> r)
    -> r -> (forall d. Data d => d -> r') -> Format -> r)
-> (forall r r'.
    (r' -> r -> r)
    -> r -> (forall d. Data d => d -> r') -> Format -> r)
-> (forall u. (forall d. Data d => d -> u) -> Format -> [u])
-> (forall u. Int -> (forall d. Data d => d -> u) -> Format -> u)
-> (forall (m :: * -> *).
    Monad m =>
    (forall d. Data d => d -> m d) -> Format -> m Format)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> Format -> m Format)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> Format -> m Format)
-> Data Format
Format -> Constr
Format -> DataType
(forall b. Data b => b -> b) -> Format -> Format
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) -> Format -> u
forall u. (forall d. Data d => d -> u) -> Format -> [u]
forall r r'.
(r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Format -> r
forall r r'.
(r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Format -> r
forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> Format -> m Format
forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> Format -> m Format
forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c Format
forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Format -> c Format
forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c Format)
forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Format)
$cgfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Format -> c Format
gfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Format -> c Format
$cgunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c Format
gunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c Format
$ctoConstr :: Format -> Constr
toConstr :: Format -> Constr
$cdataTypeOf :: Format -> DataType
dataTypeOf :: Format -> DataType
$cdataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c Format)
dataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c Format)
$cdataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Format)
dataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Format)
$cgmapT :: (forall b. Data b => b -> b) -> Format -> Format
gmapT :: (forall b. Data b => b -> b) -> Format -> Format
$cgmapQl :: forall r r'.
(r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Format -> r
gmapQl :: forall r r'.
(r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Format -> r
$cgmapQr :: forall r r'.
(r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Format -> r
gmapQr :: forall r r'.
(r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Format -> r
$cgmapQ :: forall u. (forall d. Data d => d -> u) -> Format -> [u]
gmapQ :: forall u. (forall d. Data d => d -> u) -> Format -> [u]
$cgmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> Format -> u
gmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> Format -> u
$cgmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> Format -> m Format
gmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> Format -> m Format
$cgmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> Format -> m Format
gmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> Format -> m Format
$cgmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> Format -> m Format
gmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> Format -> m Format
Data, Typeable)

instance Eq Format where
  (Format Text
t1) == :: Format -> Format -> Bool
== (Format Text
t2) = Text -> Text
T.toCaseFold Text
t1 Text -> Text -> Bool
forall a. Eq a => a -> a -> Bool
== Text -> Text
T.toCaseFold Text
t2

data ListSpacing =
       TightList
     | LooseList
     deriving (Int -> ListSpacing -> ShowS
[ListSpacing] -> ShowS
ListSpacing -> String
(Int -> ListSpacing -> ShowS)
-> (ListSpacing -> String)
-> ([ListSpacing] -> ShowS)
-> Show ListSpacing
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> ListSpacing -> ShowS
showsPrec :: Int -> ListSpacing -> ShowS
$cshow :: ListSpacing -> String
show :: ListSpacing -> String
$cshowList :: [ListSpacing] -> ShowS
showList :: [ListSpacing] -> ShowS
Show, Eq ListSpacing
Eq ListSpacing =>
(ListSpacing -> ListSpacing -> Ordering)
-> (ListSpacing -> ListSpacing -> Bool)
-> (ListSpacing -> ListSpacing -> Bool)
-> (ListSpacing -> ListSpacing -> Bool)
-> (ListSpacing -> ListSpacing -> Bool)
-> (ListSpacing -> ListSpacing -> ListSpacing)
-> (ListSpacing -> ListSpacing -> ListSpacing)
-> Ord ListSpacing
ListSpacing -> ListSpacing -> Bool
ListSpacing -> ListSpacing -> Ordering
ListSpacing -> ListSpacing -> ListSpacing
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
$ccompare :: ListSpacing -> ListSpacing -> Ordering
compare :: ListSpacing -> ListSpacing -> Ordering
$c< :: ListSpacing -> ListSpacing -> Bool
< :: ListSpacing -> ListSpacing -> Bool
$c<= :: ListSpacing -> ListSpacing -> Bool
<= :: ListSpacing -> ListSpacing -> Bool
$c> :: ListSpacing -> ListSpacing -> Bool
> :: ListSpacing -> ListSpacing -> Bool
$c>= :: ListSpacing -> ListSpacing -> Bool
>= :: ListSpacing -> ListSpacing -> Bool
$cmax :: ListSpacing -> ListSpacing -> ListSpacing
max :: ListSpacing -> ListSpacing -> ListSpacing
$cmin :: ListSpacing -> ListSpacing -> ListSpacing
min :: ListSpacing -> ListSpacing -> ListSpacing
Ord, ListSpacing -> ListSpacing -> Bool
(ListSpacing -> ListSpacing -> Bool)
-> (ListSpacing -> ListSpacing -> Bool) -> Eq ListSpacing
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: ListSpacing -> ListSpacing -> Bool
== :: ListSpacing -> ListSpacing -> Bool
$c/= :: ListSpacing -> ListSpacing -> Bool
/= :: ListSpacing -> ListSpacing -> Bool
Eq, Typeable ListSpacing
Typeable ListSpacing =>
(forall (c :: * -> *).
 (forall d b. Data d => c (d -> b) -> d -> c b)
 -> (forall g. g -> c g) -> ListSpacing -> c ListSpacing)
-> (forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c ListSpacing)
-> (ListSpacing -> Constr)
-> (ListSpacing -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c ListSpacing))
-> (forall (t :: * -> * -> *) (c :: * -> *).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e))
    -> Maybe (c ListSpacing))
-> ((forall b. Data b => b -> b) -> ListSpacing -> ListSpacing)
-> (forall r r'.
    (r -> r' -> r)
    -> r -> (forall d. Data d => d -> r') -> ListSpacing -> r)
-> (forall r r'.
    (r' -> r -> r)
    -> r -> (forall d. Data d => d -> r') -> ListSpacing -> r)
-> (forall u. (forall d. Data d => d -> u) -> ListSpacing -> [u])
-> (forall u.
    Int -> (forall d. Data d => d -> u) -> ListSpacing -> u)
-> (forall (m :: * -> *).
    Monad m =>
    (forall d. Data d => d -> m d) -> ListSpacing -> m ListSpacing)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> ListSpacing -> m ListSpacing)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> ListSpacing -> m ListSpacing)
-> Data ListSpacing
ListSpacing -> Constr
ListSpacing -> DataType
(forall b. Data b => b -> b) -> ListSpacing -> ListSpacing
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) -> ListSpacing -> u
forall u. (forall d. Data d => d -> u) -> ListSpacing -> [u]
forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> ListSpacing -> r
forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> ListSpacing -> r
forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> ListSpacing -> m ListSpacing
forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> ListSpacing -> m ListSpacing
forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c ListSpacing
forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> ListSpacing -> c ListSpacing
forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c ListSpacing)
forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c ListSpacing)
$cgfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> ListSpacing -> c ListSpacing
gfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> ListSpacing -> c ListSpacing
$cgunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c ListSpacing
gunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c ListSpacing
$ctoConstr :: ListSpacing -> Constr
toConstr :: ListSpacing -> Constr
$cdataTypeOf :: ListSpacing -> DataType
dataTypeOf :: ListSpacing -> DataType
$cdataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c ListSpacing)
dataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c ListSpacing)
$cdataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c ListSpacing)
dataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c ListSpacing)
$cgmapT :: (forall b. Data b => b -> b) -> ListSpacing -> ListSpacing
gmapT :: (forall b. Data b => b -> b) -> ListSpacing -> ListSpacing
$cgmapQl :: forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> ListSpacing -> r
gmapQl :: forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> ListSpacing -> r
$cgmapQr :: forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> ListSpacing -> r
gmapQr :: forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> ListSpacing -> r
$cgmapQ :: forall u. (forall d. Data d => d -> u) -> ListSpacing -> [u]
gmapQ :: forall u. (forall d. Data d => d -> u) -> ListSpacing -> [u]
$cgmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> ListSpacing -> u
gmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> ListSpacing -> u
$cgmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> ListSpacing -> m ListSpacing
gmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> ListSpacing -> m ListSpacing
$cgmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> ListSpacing -> m ListSpacing
gmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> ListSpacing -> m ListSpacing
$cgmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> ListSpacing -> m ListSpacing
gmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> ListSpacing -> m ListSpacing
Data, Typeable)

data EnumeratorType =
       Decimal
     | UpperAlpha
     | LowerAlpha
     | UpperRoman
     | LowerRoman
     deriving (Int -> EnumeratorType -> ShowS
[EnumeratorType] -> ShowS
EnumeratorType -> String
(Int -> EnumeratorType -> ShowS)
-> (EnumeratorType -> String)
-> ([EnumeratorType] -> ShowS)
-> Show EnumeratorType
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> EnumeratorType -> ShowS
showsPrec :: Int -> EnumeratorType -> ShowS
$cshow :: EnumeratorType -> String
show :: EnumeratorType -> String
$cshowList :: [EnumeratorType] -> ShowS
showList :: [EnumeratorType] -> ShowS
Show, Eq EnumeratorType
Eq EnumeratorType =>
(EnumeratorType -> EnumeratorType -> Ordering)
-> (EnumeratorType -> EnumeratorType -> Bool)
-> (EnumeratorType -> EnumeratorType -> Bool)
-> (EnumeratorType -> EnumeratorType -> Bool)
-> (EnumeratorType -> EnumeratorType -> Bool)
-> (EnumeratorType -> EnumeratorType -> EnumeratorType)
-> (EnumeratorType -> EnumeratorType -> EnumeratorType)
-> Ord EnumeratorType
EnumeratorType -> EnumeratorType -> Bool
EnumeratorType -> EnumeratorType -> Ordering
EnumeratorType -> EnumeratorType -> EnumeratorType
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
$ccompare :: EnumeratorType -> EnumeratorType -> Ordering
compare :: EnumeratorType -> EnumeratorType -> Ordering
$c< :: EnumeratorType -> EnumeratorType -> Bool
< :: EnumeratorType -> EnumeratorType -> Bool
$c<= :: EnumeratorType -> EnumeratorType -> Bool
<= :: EnumeratorType -> EnumeratorType -> Bool
$c> :: EnumeratorType -> EnumeratorType -> Bool
> :: EnumeratorType -> EnumeratorType -> Bool
$c>= :: EnumeratorType -> EnumeratorType -> Bool
>= :: EnumeratorType -> EnumeratorType -> Bool
$cmax :: EnumeratorType -> EnumeratorType -> EnumeratorType
max :: EnumeratorType -> EnumeratorType -> EnumeratorType
$cmin :: EnumeratorType -> EnumeratorType -> EnumeratorType
min :: EnumeratorType -> EnumeratorType -> EnumeratorType
Ord, EnumeratorType -> EnumeratorType -> Bool
(EnumeratorType -> EnumeratorType -> Bool)
-> (EnumeratorType -> EnumeratorType -> Bool) -> Eq EnumeratorType
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: EnumeratorType -> EnumeratorType -> Bool
== :: EnumeratorType -> EnumeratorType -> Bool
$c/= :: EnumeratorType -> EnumeratorType -> Bool
/= :: EnumeratorType -> EnumeratorType -> Bool
Eq, Typeable EnumeratorType
Typeable EnumeratorType =>
(forall (c :: * -> *).
 (forall d b. Data d => c (d -> b) -> d -> c b)
 -> (forall g. g -> c g) -> EnumeratorType -> c EnumeratorType)
-> (forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c EnumeratorType)
-> (EnumeratorType -> Constr)
-> (EnumeratorType -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c EnumeratorType))
-> (forall (t :: * -> * -> *) (c :: * -> *).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e))
    -> Maybe (c EnumeratorType))
-> ((forall b. Data b => b -> b)
    -> EnumeratorType -> EnumeratorType)
-> (forall r r'.
    (r -> r' -> r)
    -> r -> (forall d. Data d => d -> r') -> EnumeratorType -> r)
-> (forall r r'.
    (r' -> r -> r)
    -> r -> (forall d. Data d => d -> r') -> EnumeratorType -> r)
-> (forall u.
    (forall d. Data d => d -> u) -> EnumeratorType -> [u])
-> (forall u.
    Int -> (forall d. Data d => d -> u) -> EnumeratorType -> u)
-> (forall (m :: * -> *).
    Monad m =>
    (forall d. Data d => d -> m d)
    -> EnumeratorType -> m EnumeratorType)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d)
    -> EnumeratorType -> m EnumeratorType)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d)
    -> EnumeratorType -> m EnumeratorType)
-> Data EnumeratorType
EnumeratorType -> Constr
EnumeratorType -> DataType
(forall b. Data b => b -> b) -> EnumeratorType -> EnumeratorType
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) -> EnumeratorType -> u
forall u. (forall d. Data d => d -> u) -> EnumeratorType -> [u]
forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> EnumeratorType -> r
forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> EnumeratorType -> r
forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d)
-> EnumeratorType -> m EnumeratorType
forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d)
-> EnumeratorType -> m EnumeratorType
forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c EnumeratorType
forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> EnumeratorType -> c EnumeratorType
forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c EnumeratorType)
forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c EnumeratorType)
$cgfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> EnumeratorType -> c EnumeratorType
gfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> EnumeratorType -> c EnumeratorType
$cgunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c EnumeratorType
gunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c EnumeratorType
$ctoConstr :: EnumeratorType -> Constr
toConstr :: EnumeratorType -> Constr
$cdataTypeOf :: EnumeratorType -> DataType
dataTypeOf :: EnumeratorType -> DataType
$cdataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c EnumeratorType)
dataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c EnumeratorType)
$cdataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c EnumeratorType)
dataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c EnumeratorType)
$cgmapT :: (forall b. Data b => b -> b) -> EnumeratorType -> EnumeratorType
gmapT :: (forall b. Data b => b -> b) -> EnumeratorType -> EnumeratorType
$cgmapQl :: forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> EnumeratorType -> r
gmapQl :: forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> EnumeratorType -> r
$cgmapQr :: forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> EnumeratorType -> r
gmapQr :: forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> EnumeratorType -> r
$cgmapQ :: forall u. (forall d. Data d => d -> u) -> EnumeratorType -> [u]
gmapQ :: forall u. (forall d. Data d => d -> u) -> EnumeratorType -> [u]
$cgmapQi :: forall u.
Int -> (forall d. Data d => d -> u) -> EnumeratorType -> u
gmapQi :: forall u.
Int -> (forall d. Data d => d -> u) -> EnumeratorType -> u
$cgmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d)
-> EnumeratorType -> m EnumeratorType
gmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d)
-> EnumeratorType -> m EnumeratorType
$cgmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d)
-> EnumeratorType -> m EnumeratorType
gmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d)
-> EnumeratorType -> m EnumeratorType
$cgmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d)
-> EnumeratorType -> m EnumeratorType
gmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d)
-> EnumeratorType -> m EnumeratorType
Data, Typeable)

data DelimiterType =
       Period
     | OneParen
     | TwoParens
     deriving (Int -> DelimiterType -> ShowS
[DelimiterType] -> ShowS
DelimiterType -> String
(Int -> DelimiterType -> ShowS)
-> (DelimiterType -> String)
-> ([DelimiterType] -> ShowS)
-> Show DelimiterType
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> DelimiterType -> ShowS
showsPrec :: Int -> DelimiterType -> ShowS
$cshow :: DelimiterType -> String
show :: DelimiterType -> String
$cshowList :: [DelimiterType] -> ShowS
showList :: [DelimiterType] -> ShowS
Show, Eq DelimiterType
Eq DelimiterType =>
(DelimiterType -> DelimiterType -> Ordering)
-> (DelimiterType -> DelimiterType -> Bool)
-> (DelimiterType -> DelimiterType -> Bool)
-> (DelimiterType -> DelimiterType -> Bool)
-> (DelimiterType -> DelimiterType -> Bool)
-> (DelimiterType -> DelimiterType -> DelimiterType)
-> (DelimiterType -> DelimiterType -> DelimiterType)
-> Ord DelimiterType
DelimiterType -> DelimiterType -> Bool
DelimiterType -> DelimiterType -> Ordering
DelimiterType -> DelimiterType -> DelimiterType
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
$ccompare :: DelimiterType -> DelimiterType -> Ordering
compare :: DelimiterType -> DelimiterType -> Ordering
$c< :: DelimiterType -> DelimiterType -> Bool
< :: DelimiterType -> DelimiterType -> Bool
$c<= :: DelimiterType -> DelimiterType -> Bool
<= :: DelimiterType -> DelimiterType -> Bool
$c> :: DelimiterType -> DelimiterType -> Bool
> :: DelimiterType -> DelimiterType -> Bool
$c>= :: DelimiterType -> DelimiterType -> Bool
>= :: DelimiterType -> DelimiterType -> Bool
$cmax :: DelimiterType -> DelimiterType -> DelimiterType
max :: DelimiterType -> DelimiterType -> DelimiterType
$cmin :: DelimiterType -> DelimiterType -> DelimiterType
min :: DelimiterType -> DelimiterType -> DelimiterType
Ord, DelimiterType -> DelimiterType -> Bool
(DelimiterType -> DelimiterType -> Bool)
-> (DelimiterType -> DelimiterType -> Bool) -> Eq DelimiterType
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: DelimiterType -> DelimiterType -> Bool
== :: DelimiterType -> DelimiterType -> Bool
$c/= :: DelimiterType -> DelimiterType -> Bool
/= :: DelimiterType -> DelimiterType -> Bool
Eq, Typeable DelimiterType
Typeable DelimiterType =>
(forall (c :: * -> *).
 (forall d b. Data d => c (d -> b) -> d -> c b)
 -> (forall g. g -> c g) -> DelimiterType -> c DelimiterType)
-> (forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c DelimiterType)
-> (DelimiterType -> Constr)
-> (DelimiterType -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c DelimiterType))
-> (forall (t :: * -> * -> *) (c :: * -> *).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e))
    -> Maybe (c DelimiterType))
-> ((forall b. Data b => b -> b) -> DelimiterType -> DelimiterType)
-> (forall r r'.
    (r -> r' -> r)
    -> r -> (forall d. Data d => d -> r') -> DelimiterType -> r)
-> (forall r r'.
    (r' -> r -> r)
    -> r -> (forall d. Data d => d -> r') -> DelimiterType -> r)
-> (forall u. (forall d. Data d => d -> u) -> DelimiterType -> [u])
-> (forall u.
    Int -> (forall d. Data d => d -> u) -> DelimiterType -> u)
-> (forall (m :: * -> *).
    Monad m =>
    (forall d. Data d => d -> m d) -> DelimiterType -> m DelimiterType)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> DelimiterType -> m DelimiterType)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> DelimiterType -> m DelimiterType)
-> Data DelimiterType
DelimiterType -> Constr
DelimiterType -> DataType
(forall b. Data b => b -> b) -> DelimiterType -> DelimiterType
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) -> DelimiterType -> u
forall u. (forall d. Data d => d -> u) -> DelimiterType -> [u]
forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> DelimiterType -> r
forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> DelimiterType -> r
forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> DelimiterType -> m DelimiterType
forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> DelimiterType -> m DelimiterType
forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c DelimiterType
forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> DelimiterType -> c DelimiterType
forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c DelimiterType)
forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c DelimiterType)
$cgfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> DelimiterType -> c DelimiterType
gfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> DelimiterType -> c DelimiterType
$cgunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c DelimiterType
gunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c DelimiterType
$ctoConstr :: DelimiterType -> Constr
toConstr :: DelimiterType -> Constr
$cdataTypeOf :: DelimiterType -> DataType
dataTypeOf :: DelimiterType -> DataType
$cdataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c DelimiterType)
dataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c DelimiterType)
$cdataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c DelimiterType)
dataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c DelimiterType)
$cgmapT :: (forall b. Data b => b -> b) -> DelimiterType -> DelimiterType
gmapT :: (forall b. Data b => b -> b) -> DelimiterType -> DelimiterType
$cgmapQl :: forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> DelimiterType -> r
gmapQl :: forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> DelimiterType -> r
$cgmapQr :: forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> DelimiterType -> r
gmapQr :: forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> DelimiterType -> r
$cgmapQ :: forall u. (forall d. Data d => d -> u) -> DelimiterType -> [u]
gmapQ :: forall u. (forall d. Data d => d -> u) -> DelimiterType -> [u]
$cgmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> DelimiterType -> u
gmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> DelimiterType -> u
$cgmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> DelimiterType -> m DelimiterType
gmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> DelimiterType -> m DelimiterType
$cgmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> DelimiterType -> m DelimiterType
gmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> DelimiterType -> m DelimiterType
$cgmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> DelimiterType -> m DelimiterType
gmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> DelimiterType -> m DelimiterType
Data, Typeable)

data ListType =
       BulletList !Char
     | OrderedList !Int !EnumeratorType !DelimiterType
     -- first Text is before, second Text is after enumerator
     deriving (Int -> ListType -> ShowS
[ListType] -> ShowS
ListType -> String
(Int -> ListType -> ShowS)
-> (ListType -> String) -> ([ListType] -> ShowS) -> Show ListType
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> ListType -> ShowS
showsPrec :: Int -> ListType -> ShowS
$cshow :: ListType -> String
show :: ListType -> String
$cshowList :: [ListType] -> ShowS
showList :: [ListType] -> ShowS
Show, Eq ListType
Eq ListType =>
(ListType -> ListType -> Ordering)
-> (ListType -> ListType -> Bool)
-> (ListType -> ListType -> Bool)
-> (ListType -> ListType -> Bool)
-> (ListType -> ListType -> Bool)
-> (ListType -> ListType -> ListType)
-> (ListType -> ListType -> ListType)
-> Ord ListType
ListType -> ListType -> Bool
ListType -> ListType -> Ordering
ListType -> ListType -> ListType
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
$ccompare :: ListType -> ListType -> Ordering
compare :: ListType -> ListType -> Ordering
$c< :: ListType -> ListType -> Bool
< :: ListType -> ListType -> Bool
$c<= :: ListType -> ListType -> Bool
<= :: ListType -> ListType -> Bool
$c> :: ListType -> ListType -> Bool
> :: ListType -> ListType -> Bool
$c>= :: ListType -> ListType -> Bool
>= :: ListType -> ListType -> Bool
$cmax :: ListType -> ListType -> ListType
max :: ListType -> ListType -> ListType
$cmin :: ListType -> ListType -> ListType
min :: ListType -> ListType -> ListType
Ord, ListType -> ListType -> Bool
(ListType -> ListType -> Bool)
-> (ListType -> ListType -> Bool) -> Eq ListType
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: ListType -> ListType -> Bool
== :: ListType -> ListType -> Bool
$c/= :: ListType -> ListType -> Bool
/= :: ListType -> ListType -> Bool
Eq, Typeable ListType
Typeable ListType =>
(forall (c :: * -> *).
 (forall d b. Data d => c (d -> b) -> d -> c b)
 -> (forall g. g -> c g) -> ListType -> c ListType)
-> (forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c ListType)
-> (ListType -> Constr)
-> (ListType -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c ListType))
-> (forall (t :: * -> * -> *) (c :: * -> *).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c ListType))
-> ((forall b. Data b => b -> b) -> ListType -> ListType)
-> (forall r r'.
    (r -> r' -> r)
    -> r -> (forall d. Data d => d -> r') -> ListType -> r)
-> (forall r r'.
    (r' -> r -> r)
    -> r -> (forall d. Data d => d -> r') -> ListType -> r)
-> (forall u. (forall d. Data d => d -> u) -> ListType -> [u])
-> (forall u. Int -> (forall d. Data d => d -> u) -> ListType -> u)
-> (forall (m :: * -> *).
    Monad m =>
    (forall d. Data d => d -> m d) -> ListType -> m ListType)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> ListType -> m ListType)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> ListType -> m ListType)
-> Data ListType
ListType -> Constr
ListType -> DataType
(forall b. Data b => b -> b) -> ListType -> ListType
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) -> ListType -> u
forall u. (forall d. Data d => d -> u) -> ListType -> [u]
forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> ListType -> r
forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> ListType -> r
forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> ListType -> m ListType
forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> ListType -> m ListType
forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c ListType
forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> ListType -> c ListType
forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c ListType)
forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c ListType)
$cgfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> ListType -> c ListType
gfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> ListType -> c ListType
$cgunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c ListType
gunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c ListType
$ctoConstr :: ListType -> Constr
toConstr :: ListType -> Constr
$cdataTypeOf :: ListType -> DataType
dataTypeOf :: ListType -> DataType
$cdataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c ListType)
dataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c ListType)
$cdataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c ListType)
dataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c ListType)
$cgmapT :: (forall b. Data b => b -> b) -> ListType -> ListType
gmapT :: (forall b. Data b => b -> b) -> ListType -> ListType
$cgmapQl :: forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> ListType -> r
gmapQl :: forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> ListType -> r
$cgmapQr :: forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> ListType -> r
gmapQr :: forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> ListType -> r
$cgmapQ :: forall u. (forall d. Data d => d -> u) -> ListType -> [u]
gmapQ :: forall u. (forall d. Data d => d -> u) -> ListType -> [u]
$cgmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> ListType -> u
gmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> ListType -> u
$cgmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> ListType -> m ListType
gmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> ListType -> m ListType
$cgmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> ListType -> m ListType
gmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> ListType -> m ListType
$cgmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> ListType -> m ListType
gmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> ListType -> m ListType
Data, Typeable)

class (Monoid a, Show a, Rangeable a, HasAttributes a) => IsInline a where
  lineBreak :: a
  softBreak :: a
  str :: Text -> a
  entity :: Text -> a
  escapedChar :: Char -> a
  emph :: a -> a
  strong :: a -> a
  link :: Text -- ^ Destination
       -> Text -- ^ Title
       -> a    -- ^ Link description
       -> a
  image :: Text -- ^ Source
        -> Text -- ^ Title
        -> a    -- ^ Description
        -> a
  code :: Text -> a
  rawInline :: Format -> Text -> a

class (Monoid b, Show b, Rangeable b, IsInline il, HasAttributes b)
      => IsBlock il b | b -> il where
  paragraph :: il -> b
  plain :: il -> b
  thematicBreak :: b
  blockQuote :: b -> b
  codeBlock :: Text -> Text -> b
  heading :: Int -- ^ Level
          -> il  -- ^ text
          -> b
  rawBlock :: Format -> Text -> b
  referenceLinkDefinition :: Text -- ^ Label
                          -> (Text, Text) -- ^ Destination, title
                          -> b
  list :: ListType -> ListSpacing -> [b] -> b

newtype SourceRange = SourceRange
        { SourceRange -> [(SourcePos, SourcePos)]
unSourceRange :: [(SourcePos, SourcePos)] }
  deriving (SourceRange -> SourceRange -> Bool
(SourceRange -> SourceRange -> Bool)
-> (SourceRange -> SourceRange -> Bool) -> Eq SourceRange
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: SourceRange -> SourceRange -> Bool
== :: SourceRange -> SourceRange -> Bool
$c/= :: SourceRange -> SourceRange -> Bool
/= :: SourceRange -> SourceRange -> Bool
Eq, Eq SourceRange
Eq SourceRange =>
(SourceRange -> SourceRange -> Ordering)
-> (SourceRange -> SourceRange -> Bool)
-> (SourceRange -> SourceRange -> Bool)
-> (SourceRange -> SourceRange -> Bool)
-> (SourceRange -> SourceRange -> Bool)
-> (SourceRange -> SourceRange -> SourceRange)
-> (SourceRange -> SourceRange -> SourceRange)
-> Ord SourceRange
SourceRange -> SourceRange -> Bool
SourceRange -> SourceRange -> Ordering
SourceRange -> SourceRange -> SourceRange
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
$ccompare :: SourceRange -> SourceRange -> Ordering
compare :: SourceRange -> SourceRange -> Ordering
$c< :: SourceRange -> SourceRange -> Bool
< :: SourceRange -> SourceRange -> Bool
$c<= :: SourceRange -> SourceRange -> Bool
<= :: SourceRange -> SourceRange -> Bool
$c> :: SourceRange -> SourceRange -> Bool
> :: SourceRange -> SourceRange -> Bool
$c>= :: SourceRange -> SourceRange -> Bool
>= :: SourceRange -> SourceRange -> Bool
$cmax :: SourceRange -> SourceRange -> SourceRange
max :: SourceRange -> SourceRange -> SourceRange
$cmin :: SourceRange -> SourceRange -> SourceRange
min :: SourceRange -> SourceRange -> SourceRange
Ord, Typeable SourceRange
Typeable SourceRange =>
(forall (c :: * -> *).
 (forall d b. Data d => c (d -> b) -> d -> c b)
 -> (forall g. g -> c g) -> SourceRange -> c SourceRange)
-> (forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c SourceRange)
-> (SourceRange -> Constr)
-> (SourceRange -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c SourceRange))
-> (forall (t :: * -> * -> *) (c :: * -> *).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e))
    -> Maybe (c SourceRange))
-> ((forall b. Data b => b -> b) -> SourceRange -> SourceRange)
-> (forall r r'.
    (r -> r' -> r)
    -> r -> (forall d. Data d => d -> r') -> SourceRange -> r)
-> (forall r r'.
    (r' -> r -> r)
    -> r -> (forall d. Data d => d -> r') -> SourceRange -> r)
-> (forall u. (forall d. Data d => d -> u) -> SourceRange -> [u])
-> (forall u.
    Int -> (forall d. Data d => d -> u) -> SourceRange -> u)
-> (forall (m :: * -> *).
    Monad m =>
    (forall d. Data d => d -> m d) -> SourceRange -> m SourceRange)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> SourceRange -> m SourceRange)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> SourceRange -> m SourceRange)
-> Data SourceRange
SourceRange -> Constr
SourceRange -> DataType
(forall b. Data b => b -> b) -> SourceRange -> SourceRange
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) -> SourceRange -> u
forall u. (forall d. Data d => d -> u) -> SourceRange -> [u]
forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> SourceRange -> r
forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> SourceRange -> r
forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> SourceRange -> m SourceRange
forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> SourceRange -> m SourceRange
forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c SourceRange
forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> SourceRange -> c SourceRange
forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c SourceRange)
forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c SourceRange)
$cgfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> SourceRange -> c SourceRange
gfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> SourceRange -> c SourceRange
$cgunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c SourceRange
gunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c SourceRange
$ctoConstr :: SourceRange -> Constr
toConstr :: SourceRange -> Constr
$cdataTypeOf :: SourceRange -> DataType
dataTypeOf :: SourceRange -> DataType
$cdataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c SourceRange)
dataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c SourceRange)
$cdataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c SourceRange)
dataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c SourceRange)
$cgmapT :: (forall b. Data b => b -> b) -> SourceRange -> SourceRange
gmapT :: (forall b. Data b => b -> b) -> SourceRange -> SourceRange
$cgmapQl :: forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> SourceRange -> r
gmapQl :: forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> SourceRange -> r
$cgmapQr :: forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> SourceRange -> r
gmapQr :: forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> SourceRange -> r
$cgmapQ :: forall u. (forall d. Data d => d -> u) -> SourceRange -> [u]
gmapQ :: forall u. (forall d. Data d => d -> u) -> SourceRange -> [u]
$cgmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> SourceRange -> u
gmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> SourceRange -> u
$cgmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> SourceRange -> m SourceRange
gmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> SourceRange -> m SourceRange
$cgmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> SourceRange -> m SourceRange
gmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> SourceRange -> m SourceRange
$cgmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> SourceRange -> m SourceRange
gmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> SourceRange -> m SourceRange
Data, Typeable)

instance Semigroup SourceRange where
  (SourceRange [(SourcePos, SourcePos)]
xs) <> :: SourceRange -> SourceRange -> SourceRange
<> (SourceRange [(SourcePos, SourcePos)]
ys) =
    [(SourcePos, SourcePos)] -> SourceRange
SourceRange ([(SourcePos, SourcePos)]
-> [(SourcePos, SourcePos)] -> [(SourcePos, SourcePos)]
forall a. Eq a => [(a, a)] -> [(a, a)] -> [(a, a)]
consolidateRanges [(SourcePos, SourcePos)]
xs [(SourcePos, SourcePos)]
ys)

instance Monoid SourceRange where
  mempty :: SourceRange
mempty = [(SourcePos, SourcePos)] -> SourceRange
SourceRange [(SourcePos, SourcePos)]
forall a. Monoid a => a
mempty
  mappend :: SourceRange -> SourceRange -> SourceRange
mappend = SourceRange -> SourceRange -> SourceRange
forall a. Semigroup a => a -> a -> a
(<>)

consolidateRanges :: Eq a => [(a,a)] -> [(a,a)] -> [(a,a)]
consolidateRanges :: forall a. Eq a => [(a, a)] -> [(a, a)] -> [(a, a)]
consolidateRanges [] [(a, a)]
xs = [(a, a)]
xs
consolidateRanges [(a, a)]
xs [] = [(a, a)]
xs
consolidateRanges xs :: [(a, a)]
xs@((a, a)
_:[(a, a)]
_) ((a
s2,a
e2):[(a, a)]
ys) =
  if a
e1 a -> a -> Bool
forall a. Eq a => a -> a -> Bool
== a
s2
     then [(a, a)] -> [(a, a)]
forall a. HasCallStack => [a] -> [a]
init [(a, a)]
xs [(a, a)] -> [(a, a)] -> [(a, a)]
forall a. [a] -> [a] -> [a]
++ (a
s1,a
e2)(a, a) -> [(a, a)] -> [(a, a)]
forall a. a -> [a] -> [a]
:[(a, a)]
ys
     else [(a, a)]
xs [(a, a)] -> [(a, a)] -> [(a, a)]
forall a. [a] -> [a] -> [a]
++ (a
s2,a
e2)(a, a) -> [(a, a)] -> [(a, a)]
forall a. a -> [a] -> [a]
:[(a, a)]
ys
  where (a
s1,a
e1) = [(a, a)] -> (a, a)
forall a. HasCallStack => [a] -> a
last [(a, a)]
xs

instance Show SourceRange where
  show :: SourceRange -> String
show = SourceRange -> String
prettyRange

class Rangeable a where
  ranged :: SourceRange -> a -> a

prettyRange :: SourceRange -> String
prettyRange :: SourceRange -> String
prettyRange (SourceRange [(SourcePos, SourcePos)]
xs) = String -> [(SourcePos, SourcePos)] -> String
go String
"" [(SourcePos, SourcePos)]
xs
  where
    go :: String -> [(SourcePos, SourcePos)] -> String
go String
_ [] = String
""
    go String
curname ((SourcePos
p1,SourcePos
p2):[(SourcePos, SourcePos)]
rest)
      = (if SourcePos -> String
sourceName SourcePos
p1 String -> String -> Bool
forall a. Eq a => a -> a -> Bool
/= String
curname
            then SourcePos -> String
sourceName SourcePos
p1 String -> ShowS
forall a. [a] -> [a] -> [a]
++ String
"@"
            else String
"") String -> ShowS
forall a. [a] -> [a] -> [a]
++
         Int -> String
forall a. Show a => a -> String
show (SourcePos -> Int
sourceLine SourcePos
p1) String -> ShowS
forall a. [a] -> [a] -> [a]
++ String
":" String -> ShowS
forall a. [a] -> [a] -> [a]
++
         Int -> String
forall a. Show a => a -> String
show (SourcePos -> Int
sourceColumn SourcePos
p1) String -> ShowS
forall a. [a] -> [a] -> [a]
++ String
"-" String -> ShowS
forall a. [a] -> [a] -> [a]
++
         (if SourcePos -> String
sourceName SourcePos
p2 String -> String -> Bool
forall a. Eq a => a -> a -> Bool
/= SourcePos -> String
sourceName SourcePos
p1
             then SourcePos -> String
sourceName SourcePos
p2 String -> ShowS
forall a. [a] -> [a] -> [a]
++ String
"@"
             else String
"") String -> ShowS
forall a. [a] -> [a] -> [a]
++
         Int -> String
forall a. Show a => a -> String
show (SourcePos -> Int
sourceLine SourcePos
p2) String -> ShowS
forall a. [a] -> [a] -> [a]
++
         String
":" String -> ShowS
forall a. [a] -> [a] -> [a]
++ Int -> String
forall a. Show a => a -> String
show (SourcePos -> Int
sourceColumn SourcePos
p2) String -> ShowS
forall a. [a] -> [a] -> [a]
++
         if [(SourcePos, SourcePos)] -> Bool
forall a. [a] -> Bool
forall (t :: * -> *) a. Foldable t => t a -> Bool
null [(SourcePos, SourcePos)]
rest
            then String
""
            else String
";" String -> ShowS
forall a. [a] -> [a] -> [a]
++ String -> [(SourcePos, SourcePos)] -> String
go (SourcePos -> String
sourceName SourcePos
p2) [(SourcePos, SourcePos)]
rest

type Attribute = (Text, Text)

type Attributes = [Attribute]

class HasAttributes a where
  addAttributes :: Attributes -> a -> a

class ToPlainText a where
  toPlainText :: a -> Text