{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RankNTypes #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE StandaloneDeriving #-}
{-# LANGUAGE TemplateHaskell #-}
{-# LANGUAGE TypeFamilies #-}
module Text.RSS.Extensions.DublinCore
( DublinCoreModule(..)
, RssChannelExtension(..)
, RssItemExtension(..)
, DcMetaData(..)
, mkDcMetaData
) where
import Text.RSS.Extensions
import Text.RSS.Types
import Conduit
import Control.Exception.Safe as Exception
import Control.Monad
import Control.Monad.Fix
import Data.Maybe
import Data.Text (Text)
import qualified Data.Text as Text
import Data.Time.Clock
import Data.Time.LocalTime
import Data.Time.RFC3339
import Data.XML.Types
import GHC.Generics
import Lens.Micro
import Lens.Micro.TH
import qualified Text.XML.DublinCore.Conduit.Parse as DC
import Text.XML.DublinCore.Conduit.Render
import Text.XML.Stream.Parse
import URI.ByteString
projectC :: Monad m => Traversal' a b -> ConduitT a b m ()
projectC :: Traversal' a b -> ConduitT a b m ()
projectC Traversal' a b
prism = (ConduitT a b m () -> ConduitT a b m ()) -> ConduitT a b m ()
forall a. (a -> a) -> a
fix ((ConduitT a b m () -> ConduitT a b m ()) -> ConduitT a b m ())
-> (ConduitT a b m () -> ConduitT a b m ()) -> ConduitT a b m ()
forall a b. (a -> b) -> a -> b
$ \ConduitT a b m ()
recurse -> do
Maybe a
item <- ConduitT a b m (Maybe a)
forall (m :: * -> *) i. Monad m => Consumer i m (Maybe i)
await
case (Maybe a
item, Maybe a
item Maybe a -> Getting (First b) (Maybe a) b -> Maybe b
forall s a. s -> Getting (First a) s a -> Maybe a
^? ((a -> Const (First b) a) -> Maybe a -> Const (First b) (Maybe a)
forall a a'. Traversal (Maybe a) (Maybe a') a a'
_Just ((a -> Const (First b) a) -> Maybe a -> Const (First b) (Maybe a))
-> ((b -> Const (First b) b) -> a -> Const (First b) a)
-> Getting (First b) (Maybe a) b
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (b -> Const (First b) b) -> a -> Const (First b) a
Traversal' a b
prism)) of
(Maybe a
_, Just b
a) -> b -> ConduitT a b m ()
forall (m :: * -> *) o i. Monad m => o -> ConduitT i o m ()
yield b
a ConduitT a b m () -> ConduitT a b m () -> ConduitT a b m ()
forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
>> ConduitT a b m ()
recurse
(Just a
_, Maybe b
_) -> ConduitT a b m ()
recurse
(Maybe a, Maybe b)
_ -> () -> ConduitT a b m ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()
data DcMetaData = DcMetaData
{ DcMetaData -> Text
elementContributor :: Text
, DcMetaData -> Text
elementCoverage :: Text
, DcMetaData -> Text
elementCreator :: Text
, DcMetaData -> Maybe UTCTime
elementDate :: Maybe UTCTime
, DcMetaData -> Text
elementDescription :: Text
, DcMetaData -> Text
elementFormat :: Text
, DcMetaData -> Text
elementIdentifier :: Text
, DcMetaData -> Text
elementLanguage :: Text
, DcMetaData -> Text
elementPublisher :: Text
, DcMetaData -> Text
elementRelation :: Text
, DcMetaData -> Text
elementRights :: Text
, DcMetaData -> Text
elementSource :: Text
, DcMetaData -> Text
elementSubject :: Text
, DcMetaData -> Text
elementTitle :: Text
, DcMetaData -> Text
elementType :: Text
} deriving(DcMetaData -> DcMetaData -> Bool
(DcMetaData -> DcMetaData -> Bool)
-> (DcMetaData -> DcMetaData -> Bool) -> Eq DcMetaData
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DcMetaData -> DcMetaData -> Bool
$c/= :: DcMetaData -> DcMetaData -> Bool
== :: DcMetaData -> DcMetaData -> Bool
$c== :: DcMetaData -> DcMetaData -> Bool
Eq, (forall x. DcMetaData -> Rep DcMetaData x)
-> (forall x. Rep DcMetaData x -> DcMetaData) -> Generic DcMetaData
forall x. Rep DcMetaData x -> DcMetaData
forall x. DcMetaData -> Rep DcMetaData x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DcMetaData x -> DcMetaData
$cfrom :: forall x. DcMetaData -> Rep DcMetaData x
Generic, Eq DcMetaData
Eq DcMetaData
-> (DcMetaData -> DcMetaData -> Ordering)
-> (DcMetaData -> DcMetaData -> Bool)
-> (DcMetaData -> DcMetaData -> Bool)
-> (DcMetaData -> DcMetaData -> Bool)
-> (DcMetaData -> DcMetaData -> Bool)
-> (DcMetaData -> DcMetaData -> DcMetaData)
-> (DcMetaData -> DcMetaData -> DcMetaData)
-> Ord DcMetaData
DcMetaData -> DcMetaData -> Bool
DcMetaData -> DcMetaData -> Ordering
DcMetaData -> DcMetaData -> DcMetaData
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 :: DcMetaData -> DcMetaData -> DcMetaData
$cmin :: DcMetaData -> DcMetaData -> DcMetaData
max :: DcMetaData -> DcMetaData -> DcMetaData
$cmax :: DcMetaData -> DcMetaData -> DcMetaData
>= :: DcMetaData -> DcMetaData -> Bool
$c>= :: DcMetaData -> DcMetaData -> Bool
> :: DcMetaData -> DcMetaData -> Bool
$c> :: DcMetaData -> DcMetaData -> Bool
<= :: DcMetaData -> DcMetaData -> Bool
$c<= :: DcMetaData -> DcMetaData -> Bool
< :: DcMetaData -> DcMetaData -> Bool
$c< :: DcMetaData -> DcMetaData -> Bool
compare :: DcMetaData -> DcMetaData -> Ordering
$ccompare :: DcMetaData -> DcMetaData -> Ordering
$cp1Ord :: Eq DcMetaData
Ord, ReadPrec [DcMetaData]
ReadPrec DcMetaData
Int -> ReadS DcMetaData
ReadS [DcMetaData]
(Int -> ReadS DcMetaData)
-> ReadS [DcMetaData]
-> ReadPrec DcMetaData
-> ReadPrec [DcMetaData]
-> Read DcMetaData
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DcMetaData]
$creadListPrec :: ReadPrec [DcMetaData]
readPrec :: ReadPrec DcMetaData
$creadPrec :: ReadPrec DcMetaData
readList :: ReadS [DcMetaData]
$creadList :: ReadS [DcMetaData]
readsPrec :: Int -> ReadS DcMetaData
$creadsPrec :: Int -> ReadS DcMetaData
Read, Int -> DcMetaData -> ShowS
[DcMetaData] -> ShowS
DcMetaData -> String
(Int -> DcMetaData -> ShowS)
-> (DcMetaData -> String)
-> ([DcMetaData] -> ShowS)
-> Show DcMetaData
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DcMetaData] -> ShowS
$cshowList :: [DcMetaData] -> ShowS
show :: DcMetaData -> String
$cshow :: DcMetaData -> String
showsPrec :: Int -> DcMetaData -> ShowS
$cshowsPrec :: Int -> DcMetaData -> ShowS
Show)
mkDcMetaData :: DcMetaData
mkDcMetaData = Text
-> Text
-> Text
-> Maybe UTCTime
-> Text
-> Text
-> Text
-> Text
-> Text
-> Text
-> Text
-> Text
-> Text
-> Text
-> Text
-> DcMetaData
DcMetaData Text
forall a. Monoid a => a
mempty Text
forall a. Monoid a => a
mempty Text
forall a. Monoid a => a
mempty Maybe UTCTime
forall a. Maybe a
Nothing Text
forall a. Monoid a => a
mempty Text
forall a. Monoid a => a
mempty Text
forall a. Monoid a => a
mempty Text
forall a. Monoid a => a
mempty Text
forall a. Monoid a => a
mempty Text
forall a. Monoid a => a
mempty Text
forall a. Monoid a => a
mempty Text
forall a. Monoid a => a
mempty Text
forall a. Monoid a => a
mempty Text
forall a. Monoid a => a
mempty Text
forall a. Monoid a => a
mempty
data ElementPiece = ElementContributor { ElementPiece -> Text
__elementContributor :: Text }
| ElementCoverage { ElementPiece -> Text
__elementCoverage :: Text }
| ElementCreator { ElementPiece -> Text
__elementCreator :: Text }
| ElementDate { ElementPiece -> UTCTime
__elementDate :: UTCTime }
| ElementDescription { ElementPiece -> Text
__elementDescription :: Text }
| ElementFormat { ElementPiece -> Text
__elementFormat :: Text }
| ElementIdentifier { ElementPiece -> Text
__elementIdentifier :: Text }
| ElementLanguage { ElementPiece -> Text
__elementLanguage :: Text }
| ElementPublisher { ElementPiece -> Text
__elementPublisher :: Text }
| ElementRelation { ElementPiece -> Text
__elementRelation :: Text }
| ElementRights { ElementPiece -> Text
__elementRights :: Text }
| ElementSource { ElementPiece -> Text
__elementSource :: Text }
| ElementSubject { ElementPiece -> Text
__elementSubject :: Text }
| ElementTitle { ElementPiece -> Text
__elementTitle :: Text }
| ElementType { ElementPiece -> Text
__elementType :: Text }
makeLenses ''ElementPiece
dcMetadata :: MonadThrow m => ConduitT Event o m DcMetaData
dcMetadata :: ConduitT Event o m DcMetaData
dcMetadata = ConduitT Event ElementPiece m (Maybe ElementPiece)
-> ConduitT Event ElementPiece m ()
forall (m :: * -> *) b.
MonadThrow m =>
ConduitT Event b m (Maybe b) -> ConduitT Event b m ()
manyYield' ([ConduitT Event ElementPiece m (Maybe ElementPiece)]
-> ConduitT Event ElementPiece m (Maybe ElementPiece)
forall (m :: * -> *) o a.
Monad m =>
[ConduitT Event o m (Maybe a)] -> ConduitT Event o m (Maybe a)
choose [ConduitT Event ElementPiece m (Maybe ElementPiece)]
forall o. [ConduitT Event o m (Maybe ElementPiece)]
piece) ConduitT Event ElementPiece m ()
-> ConduitM ElementPiece o m DcMetaData
-> ConduitT Event o m DcMetaData
forall (m :: * -> *) a b c r.
Monad m =>
ConduitM a b m () -> ConduitM b c m r -> ConduitM a c m r
.| ConduitM ElementPiece o m DcMetaData
forall o. ConduitT ElementPiece o m DcMetaData
parser where
parser :: ConduitT ElementPiece o m DcMetaData
parser = ZipConduit ElementPiece o m DcMetaData
-> ConduitT ElementPiece o m DcMetaData
forall i o (m :: * -> *) r. ZipConduit i o m r -> ConduitT i o m r
getZipConduit (ZipConduit ElementPiece o m DcMetaData
-> ConduitT ElementPiece o m DcMetaData)
-> ZipConduit ElementPiece o m DcMetaData
-> ConduitT ElementPiece o m DcMetaData
forall a b. (a -> b) -> a -> b
$ Text
-> Text
-> Text
-> Maybe UTCTime
-> Text
-> Text
-> Text
-> Text
-> Text
-> Text
-> Text
-> Text
-> Text
-> Text
-> Text
-> DcMetaData
DcMetaData
(Text
-> Text
-> Text
-> Maybe UTCTime
-> Text
-> Text
-> Text
-> Text
-> Text
-> Text
-> Text
-> Text
-> Text
-> Text
-> Text
-> DcMetaData)
-> ZipConduit ElementPiece o m Text
-> ZipConduit
ElementPiece
o
m
(Text
-> Text
-> Maybe UTCTime
-> Text
-> Text
-> Text
-> Text
-> Text
-> Text
-> Text
-> Text
-> Text
-> Text
-> Text
-> DcMetaData)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> ConduitT ElementPiece o m Text -> ZipConduit ElementPiece o m Text
forall i o (m :: * -> *) r. ConduitT i o m r -> ZipConduit i o m r
ZipConduit (Traversal' ElementPiece Text -> ConduitT ElementPiece Text m ()
forall (m :: * -> *) a b.
Monad m =>
Traversal' a b -> ConduitT a b m ()
projectC Traversal' ElementPiece Text
_elementContributor ConduitT ElementPiece Text m ()
-> ConduitM Text o m Text -> ConduitT ElementPiece o m Text
forall (m :: * -> *) a b c r.
Monad m =>
ConduitM a b m () -> ConduitM b c m r -> ConduitM a c m r
.| Text -> ConduitM Text o m Text
forall (m :: * -> *) a o. Monad m => a -> ConduitT a o m a
headDefC Text
"")
ZipConduit
ElementPiece
o
m
(Text
-> Text
-> Maybe UTCTime
-> Text
-> Text
-> Text
-> Text
-> Text
-> Text
-> Text
-> Text
-> Text
-> Text
-> Text
-> DcMetaData)
-> ZipConduit ElementPiece o m Text
-> ZipConduit
ElementPiece
o
m
(Text
-> Maybe UTCTime
-> Text
-> Text
-> Text
-> Text
-> Text
-> Text
-> Text
-> Text
-> Text
-> Text
-> Text
-> DcMetaData)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> ConduitT ElementPiece o m Text -> ZipConduit ElementPiece o m Text
forall i o (m :: * -> *) r. ConduitT i o m r -> ZipConduit i o m r
ZipConduit (Traversal' ElementPiece Text -> ConduitT ElementPiece Text m ()
forall (m :: * -> *) a b.
Monad m =>
Traversal' a b -> ConduitT a b m ()
projectC Traversal' ElementPiece Text
_elementCoverage ConduitT ElementPiece Text m ()
-> ConduitM Text o m Text -> ConduitT ElementPiece o m Text
forall (m :: * -> *) a b c r.
Monad m =>
ConduitM a b m () -> ConduitM b c m r -> ConduitM a c m r
.| Text -> ConduitM Text o m Text
forall (m :: * -> *) a o. Monad m => a -> ConduitT a o m a
headDefC Text
"")
ZipConduit
ElementPiece
o
m
(Text
-> Maybe UTCTime
-> Text
-> Text
-> Text
-> Text
-> Text
-> Text
-> Text
-> Text
-> Text
-> Text
-> Text
-> DcMetaData)
-> ZipConduit ElementPiece o m Text
-> ZipConduit
ElementPiece
o
m
(Maybe UTCTime
-> Text
-> Text
-> Text
-> Text
-> Text
-> Text
-> Text
-> Text
-> Text
-> Text
-> Text
-> DcMetaData)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> ConduitT ElementPiece o m Text -> ZipConduit ElementPiece o m Text
forall i o (m :: * -> *) r. ConduitT i o m r -> ZipConduit i o m r
ZipConduit (Traversal' ElementPiece Text -> ConduitT ElementPiece Text m ()
forall (m :: * -> *) a b.
Monad m =>
Traversal' a b -> ConduitT a b m ()
projectC Traversal' ElementPiece Text
_elementCreator ConduitT ElementPiece Text m ()
-> ConduitM Text o m Text -> ConduitT ElementPiece o m Text
forall (m :: * -> *) a b c r.
Monad m =>
ConduitM a b m () -> ConduitM b c m r -> ConduitM a c m r
.| Text -> ConduitM Text o m Text
forall (m :: * -> *) a o. Monad m => a -> ConduitT a o m a
headDefC Text
"")
ZipConduit
ElementPiece
o
m
(Maybe UTCTime
-> Text
-> Text
-> Text
-> Text
-> Text
-> Text
-> Text
-> Text
-> Text
-> Text
-> Text
-> DcMetaData)
-> ZipConduit ElementPiece o m (Maybe UTCTime)
-> ZipConduit
ElementPiece
o
m
(Text
-> Text
-> Text
-> Text
-> Text
-> Text
-> Text
-> Text
-> Text
-> Text
-> Text
-> DcMetaData)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> ConduitT ElementPiece o m (Maybe UTCTime)
-> ZipConduit ElementPiece o m (Maybe UTCTime)
forall i o (m :: * -> *) r. ConduitT i o m r -> ZipConduit i o m r
ZipConduit (Traversal' ElementPiece UTCTime
-> ConduitT ElementPiece UTCTime m ()
forall (m :: * -> *) a b.
Monad m =>
Traversal' a b -> ConduitT a b m ()
projectC Traversal' ElementPiece UTCTime
_elementDate ConduitT ElementPiece UTCTime m ()
-> ConduitM UTCTime o m (Maybe UTCTime)
-> ConduitT ElementPiece o m (Maybe UTCTime)
forall (m :: * -> *) a b c r.
Monad m =>
ConduitM a b m () -> ConduitM b c m r -> ConduitM a c m r
.| ConduitM UTCTime o m (Maybe UTCTime)
forall (m :: * -> *) a o. Monad m => ConduitT a o m (Maybe a)
headC)
ZipConduit
ElementPiece
o
m
(Text
-> Text
-> Text
-> Text
-> Text
-> Text
-> Text
-> Text
-> Text
-> Text
-> Text
-> DcMetaData)
-> ZipConduit ElementPiece o m Text
-> ZipConduit
ElementPiece
o
m
(Text
-> Text
-> Text
-> Text
-> Text
-> Text
-> Text
-> Text
-> Text
-> Text
-> DcMetaData)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> ConduitT ElementPiece o m Text -> ZipConduit ElementPiece o m Text
forall i o (m :: * -> *) r. ConduitT i o m r -> ZipConduit i o m r
ZipConduit (Traversal' ElementPiece Text -> ConduitT ElementPiece Text m ()
forall (m :: * -> *) a b.
Monad m =>
Traversal' a b -> ConduitT a b m ()
projectC Traversal' ElementPiece Text
_elementDescription ConduitT ElementPiece Text m ()
-> ConduitM Text o m Text -> ConduitT ElementPiece o m Text
forall (m :: * -> *) a b c r.
Monad m =>
ConduitM a b m () -> ConduitM b c m r -> ConduitM a c m r
.| Text -> ConduitM Text o m Text
forall (m :: * -> *) a o. Monad m => a -> ConduitT a o m a
headDefC Text
"")
ZipConduit
ElementPiece
o
m
(Text
-> Text
-> Text
-> Text
-> Text
-> Text
-> Text
-> Text
-> Text
-> Text
-> DcMetaData)
-> ZipConduit ElementPiece o m Text
-> ZipConduit
ElementPiece
o
m
(Text
-> Text
-> Text
-> Text
-> Text
-> Text
-> Text
-> Text
-> Text
-> DcMetaData)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> ConduitT ElementPiece o m Text -> ZipConduit ElementPiece o m Text
forall i o (m :: * -> *) r. ConduitT i o m r -> ZipConduit i o m r
ZipConduit (Traversal' ElementPiece Text -> ConduitT ElementPiece Text m ()
forall (m :: * -> *) a b.
Monad m =>
Traversal' a b -> ConduitT a b m ()
projectC Traversal' ElementPiece Text
_elementFormat ConduitT ElementPiece Text m ()
-> ConduitM Text o m Text -> ConduitT ElementPiece o m Text
forall (m :: * -> *) a b c r.
Monad m =>
ConduitM a b m () -> ConduitM b c m r -> ConduitM a c m r
.| Text -> ConduitM Text o m Text
forall (m :: * -> *) a o. Monad m => a -> ConduitT a o m a
headDefC Text
"")
ZipConduit
ElementPiece
o
m
(Text
-> Text
-> Text
-> Text
-> Text
-> Text
-> Text
-> Text
-> Text
-> DcMetaData)
-> ZipConduit ElementPiece o m Text
-> ZipConduit
ElementPiece
o
m
(Text
-> Text
-> Text
-> Text
-> Text
-> Text
-> Text
-> Text
-> DcMetaData)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> ConduitT ElementPiece o m Text -> ZipConduit ElementPiece o m Text
forall i o (m :: * -> *) r. ConduitT i o m r -> ZipConduit i o m r
ZipConduit (Traversal' ElementPiece Text -> ConduitT ElementPiece Text m ()
forall (m :: * -> *) a b.
Monad m =>
Traversal' a b -> ConduitT a b m ()
projectC Traversal' ElementPiece Text
_elementIdentifier ConduitT ElementPiece Text m ()
-> ConduitM Text o m Text -> ConduitT ElementPiece o m Text
forall (m :: * -> *) a b c r.
Monad m =>
ConduitM a b m () -> ConduitM b c m r -> ConduitM a c m r
.| Text -> ConduitM Text o m Text
forall (m :: * -> *) a o. Monad m => a -> ConduitT a o m a
headDefC Text
"")
ZipConduit
ElementPiece
o
m
(Text
-> Text
-> Text
-> Text
-> Text
-> Text
-> Text
-> Text
-> DcMetaData)
-> ZipConduit ElementPiece o m Text
-> ZipConduit
ElementPiece
o
m
(Text
-> Text -> Text -> Text -> Text -> Text -> Text -> DcMetaData)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> ConduitT ElementPiece o m Text -> ZipConduit ElementPiece o m Text
forall i o (m :: * -> *) r. ConduitT i o m r -> ZipConduit i o m r
ZipConduit (Traversal' ElementPiece Text -> ConduitT ElementPiece Text m ()
forall (m :: * -> *) a b.
Monad m =>
Traversal' a b -> ConduitT a b m ()
projectC Traversal' ElementPiece Text
_elementLanguage ConduitT ElementPiece Text m ()
-> ConduitM Text o m Text -> ConduitT ElementPiece o m Text
forall (m :: * -> *) a b c r.
Monad m =>
ConduitM a b m () -> ConduitM b c m r -> ConduitM a c m r
.| Text -> ConduitM Text o m Text
forall (m :: * -> *) a o. Monad m => a -> ConduitT a o m a
headDefC Text
"")
ZipConduit
ElementPiece
o
m
(Text
-> Text -> Text -> Text -> Text -> Text -> Text -> DcMetaData)
-> ZipConduit ElementPiece o m Text
-> ZipConduit
ElementPiece
o
m
(Text -> Text -> Text -> Text -> Text -> Text -> DcMetaData)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> ConduitT ElementPiece o m Text -> ZipConduit ElementPiece o m Text
forall i o (m :: * -> *) r. ConduitT i o m r -> ZipConduit i o m r
ZipConduit (Traversal' ElementPiece Text -> ConduitT ElementPiece Text m ()
forall (m :: * -> *) a b.
Monad m =>
Traversal' a b -> ConduitT a b m ()
projectC Traversal' ElementPiece Text
_elementPublisher ConduitT ElementPiece Text m ()
-> ConduitM Text o m Text -> ConduitT ElementPiece o m Text
forall (m :: * -> *) a b c r.
Monad m =>
ConduitM a b m () -> ConduitM b c m r -> ConduitM a c m r
.| Text -> ConduitM Text o m Text
forall (m :: * -> *) a o. Monad m => a -> ConduitT a o m a
headDefC Text
"")
ZipConduit
ElementPiece
o
m
(Text -> Text -> Text -> Text -> Text -> Text -> DcMetaData)
-> ZipConduit ElementPiece o m Text
-> ZipConduit
ElementPiece
o
m
(Text -> Text -> Text -> Text -> Text -> DcMetaData)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> ConduitT ElementPiece o m Text -> ZipConduit ElementPiece o m Text
forall i o (m :: * -> *) r. ConduitT i o m r -> ZipConduit i o m r
ZipConduit (Traversal' ElementPiece Text -> ConduitT ElementPiece Text m ()
forall (m :: * -> *) a b.
Monad m =>
Traversal' a b -> ConduitT a b m ()
projectC Traversal' ElementPiece Text
_elementRelation ConduitT ElementPiece Text m ()
-> ConduitM Text o m Text -> ConduitT ElementPiece o m Text
forall (m :: * -> *) a b c r.
Monad m =>
ConduitM a b m () -> ConduitM b c m r -> ConduitM a c m r
.| Text -> ConduitM Text o m Text
forall (m :: * -> *) a o. Monad m => a -> ConduitT a o m a
headDefC Text
"")
ZipConduit
ElementPiece
o
m
(Text -> Text -> Text -> Text -> Text -> DcMetaData)
-> ZipConduit ElementPiece o m Text
-> ZipConduit
ElementPiece o m (Text -> Text -> Text -> Text -> DcMetaData)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> ConduitT ElementPiece o m Text -> ZipConduit ElementPiece o m Text
forall i o (m :: * -> *) r. ConduitT i o m r -> ZipConduit i o m r
ZipConduit (Traversal' ElementPiece Text -> ConduitT ElementPiece Text m ()
forall (m :: * -> *) a b.
Monad m =>
Traversal' a b -> ConduitT a b m ()
projectC Traversal' ElementPiece Text
_elementRights ConduitT ElementPiece Text m ()
-> ConduitM Text o m Text -> ConduitT ElementPiece o m Text
forall (m :: * -> *) a b c r.
Monad m =>
ConduitM a b m () -> ConduitM b c m r -> ConduitM a c m r
.| Text -> ConduitM Text o m Text
forall (m :: * -> *) a o. Monad m => a -> ConduitT a o m a
headDefC Text
"")
ZipConduit
ElementPiece o m (Text -> Text -> Text -> Text -> DcMetaData)
-> ZipConduit ElementPiece o m Text
-> ZipConduit ElementPiece o m (Text -> Text -> Text -> DcMetaData)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> ConduitT ElementPiece o m Text -> ZipConduit ElementPiece o m Text
forall i o (m :: * -> *) r. ConduitT i o m r -> ZipConduit i o m r
ZipConduit (Traversal' ElementPiece Text -> ConduitT ElementPiece Text m ()
forall (m :: * -> *) a b.
Monad m =>
Traversal' a b -> ConduitT a b m ()
projectC Traversal' ElementPiece Text
_elementSource ConduitT ElementPiece Text m ()
-> ConduitM Text o m Text -> ConduitT ElementPiece o m Text
forall (m :: * -> *) a b c r.
Monad m =>
ConduitM a b m () -> ConduitM b c m r -> ConduitM a c m r
.| Text -> ConduitM Text o m Text
forall (m :: * -> *) a o. Monad m => a -> ConduitT a o m a
headDefC Text
"")
ZipConduit ElementPiece o m (Text -> Text -> Text -> DcMetaData)
-> ZipConduit ElementPiece o m Text
-> ZipConduit ElementPiece o m (Text -> Text -> DcMetaData)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> ConduitT ElementPiece o m Text -> ZipConduit ElementPiece o m Text
forall i o (m :: * -> *) r. ConduitT i o m r -> ZipConduit i o m r
ZipConduit (Traversal' ElementPiece Text -> ConduitT ElementPiece Text m ()
forall (m :: * -> *) a b.
Monad m =>
Traversal' a b -> ConduitT a b m ()
projectC Traversal' ElementPiece Text
_elementSubject ConduitT ElementPiece Text m ()
-> ConduitM Text o m Text -> ConduitT ElementPiece o m Text
forall (m :: * -> *) a b c r.
Monad m =>
ConduitM a b m () -> ConduitM b c m r -> ConduitM a c m r
.| Text -> ConduitM Text o m Text
forall (m :: * -> *) a o. Monad m => a -> ConduitT a o m a
headDefC Text
"")
ZipConduit ElementPiece o m (Text -> Text -> DcMetaData)
-> ZipConduit ElementPiece o m Text
-> ZipConduit ElementPiece o m (Text -> DcMetaData)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> ConduitT ElementPiece o m Text -> ZipConduit ElementPiece o m Text
forall i o (m :: * -> *) r. ConduitT i o m r -> ZipConduit i o m r
ZipConduit (Traversal' ElementPiece Text -> ConduitT ElementPiece Text m ()
forall (m :: * -> *) a b.
Monad m =>
Traversal' a b -> ConduitT a b m ()
projectC Traversal' ElementPiece Text
_elementTitle ConduitT ElementPiece Text m ()
-> ConduitM Text o m Text -> ConduitT ElementPiece o m Text
forall (m :: * -> *) a b c r.
Monad m =>
ConduitM a b m () -> ConduitM b c m r -> ConduitM a c m r
.| Text -> ConduitM Text o m Text
forall (m :: * -> *) a o. Monad m => a -> ConduitT a o m a
headDefC Text
"")
ZipConduit ElementPiece o m (Text -> DcMetaData)
-> ZipConduit ElementPiece o m Text
-> ZipConduit ElementPiece o m DcMetaData
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> ConduitT ElementPiece o m Text -> ZipConduit ElementPiece o m Text
forall i o (m :: * -> *) r. ConduitT i o m r -> ZipConduit i o m r
ZipConduit (Traversal' ElementPiece Text -> ConduitT ElementPiece Text m ()
forall (m :: * -> *) a b.
Monad m =>
Traversal' a b -> ConduitT a b m ()
projectC Traversal' ElementPiece Text
_elementType ConduitT ElementPiece Text m ()
-> ConduitM Text o m Text -> ConduitT ElementPiece o m Text
forall (m :: * -> *) a b c r.
Monad m =>
ConduitM a b m () -> ConduitM b c m r -> ConduitM a c m r
.| Text -> ConduitM Text o m Text
forall (m :: * -> *) a o. Monad m => a -> ConduitT a o m a
headDefC Text
"")
piece :: [ConduitT Event o m (Maybe ElementPiece)]
piece = [ (Text -> ElementPiece) -> Maybe Text -> Maybe ElementPiece
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap Text -> ElementPiece
ElementContributor (Maybe Text -> Maybe ElementPiece)
-> ConduitT Event o m (Maybe Text)
-> ConduitT Event o m (Maybe ElementPiece)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> ConduitT Event o m (Maybe Text)
forall (m :: * -> *) o.
MonadThrow m =>
ConduitM Event o m (Maybe Text)
DC.elementContributor
, (Text -> ElementPiece) -> Maybe Text -> Maybe ElementPiece
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap Text -> ElementPiece
ElementCoverage (Maybe Text -> Maybe ElementPiece)
-> ConduitT Event o m (Maybe Text)
-> ConduitT Event o m (Maybe ElementPiece)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> ConduitT Event o m (Maybe Text)
forall (m :: * -> *) o.
MonadThrow m =>
ConduitM Event o m (Maybe Text)
DC.elementCoverage
, (Text -> ElementPiece) -> Maybe Text -> Maybe ElementPiece
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap Text -> ElementPiece
ElementCreator (Maybe Text -> Maybe ElementPiece)
-> ConduitT Event o m (Maybe Text)
-> ConduitT Event o m (Maybe ElementPiece)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> ConduitT Event o m (Maybe Text)
forall (m :: * -> *) o.
MonadThrow m =>
ConduitM Event o m (Maybe Text)
DC.elementCreator
, (UTCTime -> ElementPiece) -> Maybe UTCTime -> Maybe ElementPiece
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap UTCTime -> ElementPiece
ElementDate (Maybe UTCTime -> Maybe ElementPiece)
-> ConduitT Event o m (Maybe UTCTime)
-> ConduitT Event o m (Maybe ElementPiece)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> ConduitT Event o m (Maybe UTCTime)
forall (m :: * -> *) o.
MonadThrow m =>
ConduitM Event o m (Maybe UTCTime)
DC.elementDate
, (Text -> ElementPiece) -> Maybe Text -> Maybe ElementPiece
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap Text -> ElementPiece
ElementDescription (Maybe Text -> Maybe ElementPiece)
-> ConduitT Event o m (Maybe Text)
-> ConduitT Event o m (Maybe ElementPiece)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> ConduitT Event o m (Maybe Text)
forall (m :: * -> *) o.
MonadThrow m =>
ConduitM Event o m (Maybe Text)
DC.elementDescription
, (Text -> ElementPiece) -> Maybe Text -> Maybe ElementPiece
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap Text -> ElementPiece
ElementFormat (Maybe Text -> Maybe ElementPiece)
-> ConduitT Event o m (Maybe Text)
-> ConduitT Event o m (Maybe ElementPiece)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> ConduitT Event o m (Maybe Text)
forall (m :: * -> *) o.
MonadThrow m =>
ConduitM Event o m (Maybe Text)
DC.elementFormat
, (Text -> ElementPiece) -> Maybe Text -> Maybe ElementPiece
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap Text -> ElementPiece
ElementIdentifier (Maybe Text -> Maybe ElementPiece)
-> ConduitT Event o m (Maybe Text)
-> ConduitT Event o m (Maybe ElementPiece)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> ConduitT Event o m (Maybe Text)
forall (m :: * -> *) o.
MonadThrow m =>
ConduitM Event o m (Maybe Text)
DC.elementIdentifier
, (Text -> ElementPiece) -> Maybe Text -> Maybe ElementPiece
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap Text -> ElementPiece
ElementLanguage (Maybe Text -> Maybe ElementPiece)
-> ConduitT Event o m (Maybe Text)
-> ConduitT Event o m (Maybe ElementPiece)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> ConduitT Event o m (Maybe Text)
forall (m :: * -> *) o.
MonadThrow m =>
ConduitM Event o m (Maybe Text)
DC.elementLanguage
, (Text -> ElementPiece) -> Maybe Text -> Maybe ElementPiece
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap Text -> ElementPiece
ElementPublisher (Maybe Text -> Maybe ElementPiece)
-> ConduitT Event o m (Maybe Text)
-> ConduitT Event o m (Maybe ElementPiece)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> ConduitT Event o m (Maybe Text)
forall (m :: * -> *) o.
MonadThrow m =>
ConduitM Event o m (Maybe Text)
DC.elementPublisher
, (Text -> ElementPiece) -> Maybe Text -> Maybe ElementPiece
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap Text -> ElementPiece
ElementRelation (Maybe Text -> Maybe ElementPiece)
-> ConduitT Event o m (Maybe Text)
-> ConduitT Event o m (Maybe ElementPiece)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> ConduitT Event o m (Maybe Text)
forall (m :: * -> *) o.
MonadThrow m =>
ConduitM Event o m (Maybe Text)
DC.elementRelation
, (Text -> ElementPiece) -> Maybe Text -> Maybe ElementPiece
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap Text -> ElementPiece
ElementRights (Maybe Text -> Maybe ElementPiece)
-> ConduitT Event o m (Maybe Text)
-> ConduitT Event o m (Maybe ElementPiece)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> ConduitT Event o m (Maybe Text)
forall (m :: * -> *) o.
MonadThrow m =>
ConduitM Event o m (Maybe Text)
DC.elementRights
, (Text -> ElementPiece) -> Maybe Text -> Maybe ElementPiece
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap Text -> ElementPiece
ElementSource (Maybe Text -> Maybe ElementPiece)
-> ConduitT Event o m (Maybe Text)
-> ConduitT Event o m (Maybe ElementPiece)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> ConduitT Event o m (Maybe Text)
forall (m :: * -> *) o.
MonadThrow m =>
ConduitM Event o m (Maybe Text)
DC.elementSource
, (Text -> ElementPiece) -> Maybe Text -> Maybe ElementPiece
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap Text -> ElementPiece
ElementSubject (Maybe Text -> Maybe ElementPiece)
-> ConduitT Event o m (Maybe Text)
-> ConduitT Event o m (Maybe ElementPiece)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> ConduitT Event o m (Maybe Text)
forall (m :: * -> *) o.
MonadThrow m =>
ConduitM Event o m (Maybe Text)
DC.elementSubject
, (Text -> ElementPiece) -> Maybe Text -> Maybe ElementPiece
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap Text -> ElementPiece
ElementTitle (Maybe Text -> Maybe ElementPiece)
-> ConduitT Event o m (Maybe Text)
-> ConduitT Event o m (Maybe ElementPiece)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> ConduitT Event o m (Maybe Text)
forall (m :: * -> *) o.
MonadThrow m =>
ConduitM Event o m (Maybe Text)
DC.elementTitle
, (Text -> ElementPiece) -> Maybe Text -> Maybe ElementPiece
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap Text -> ElementPiece
ElementType (Maybe Text -> Maybe ElementPiece)
-> ConduitT Event o m (Maybe Text)
-> ConduitT Event o m (Maybe ElementPiece)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> ConduitT Event o m (Maybe Text)
forall (m :: * -> *) o.
MonadThrow m =>
ConduitM Event o m (Maybe Text)
DC.elementType
]
renderDcMetadata :: Monad m => DcMetaData -> ConduitT () Event m ()
renderDcMetadata :: DcMetaData -> ConduitT () Event m ()
renderDcMetadata DcMetaData{Maybe UTCTime
Text
elementType :: Text
elementTitle :: Text
elementSubject :: Text
elementSource :: Text
elementRights :: Text
elementRelation :: Text
elementPublisher :: Text
elementLanguage :: Text
elementIdentifier :: Text
elementFormat :: Text
elementDescription :: Text
elementDate :: Maybe UTCTime
elementCreator :: Text
elementCoverage :: Text
elementContributor :: Text
elementType :: DcMetaData -> Text
elementTitle :: DcMetaData -> Text
elementSubject :: DcMetaData -> Text
elementSource :: DcMetaData -> Text
elementRights :: DcMetaData -> Text
elementRelation :: DcMetaData -> Text
elementPublisher :: DcMetaData -> Text
elementLanguage :: DcMetaData -> Text
elementIdentifier :: DcMetaData -> Text
elementFormat :: DcMetaData -> Text
elementDescription :: DcMetaData -> Text
elementDate :: DcMetaData -> Maybe UTCTime
elementCreator :: DcMetaData -> Text
elementCoverage :: DcMetaData -> Text
elementContributor :: DcMetaData -> Text
..} = do
Bool -> ConduitT () Event m () -> ConduitT () Event m ()
forall (f :: * -> *). Applicative f => Bool -> f () -> f ()
unless (Text -> Bool
Text.null Text
elementContributor) (ConduitT () Event m () -> ConduitT () Event m ())
-> ConduitT () Event m () -> ConduitT () Event m ()
forall a b. (a -> b) -> a -> b
$ Text -> ConduitT () Event m ()
forall (m :: * -> *). Monad m => Text -> Source m Event
renderElementContributor Text
elementContributor
Bool -> ConduitT () Event m () -> ConduitT () Event m ()
forall (f :: * -> *). Applicative f => Bool -> f () -> f ()
unless (Text -> Bool
Text.null Text
elementCoverage) (ConduitT () Event m () -> ConduitT () Event m ())
-> ConduitT () Event m () -> ConduitT () Event m ()
forall a b. (a -> b) -> a -> b
$ Text -> ConduitT () Event m ()
forall (m :: * -> *). Monad m => Text -> Source m Event
renderElementCoverage Text
elementCoverage
Bool -> ConduitT () Event m () -> ConduitT () Event m ()
forall (f :: * -> *). Applicative f => Bool -> f () -> f ()
unless (Text -> Bool
Text.null Text
elementCreator) (ConduitT () Event m () -> ConduitT () Event m ())
-> ConduitT () Event m () -> ConduitT () Event m ()
forall a b. (a -> b) -> a -> b
$ Text -> ConduitT () Event m ()
forall (m :: * -> *). Monad m => Text -> Source m Event
renderElementCreator Text
elementCreator
Maybe UTCTime
-> (UTCTime -> ConduitT () Event m ()) -> ConduitT () Event m ()
forall (t :: * -> *) (m :: * -> *) a b.
(Foldable t, Monad m) =>
t a -> (a -> m b) -> m ()
forM_ Maybe UTCTime
elementDate UTCTime -> ConduitT () Event m ()
forall (m :: * -> *). Monad m => UTCTime -> Source m Event
renderElementDate
Bool -> ConduitT () Event m () -> ConduitT () Event m ()
forall (f :: * -> *). Applicative f => Bool -> f () -> f ()
unless (Text -> Bool
Text.null Text
elementDescription) (ConduitT () Event m () -> ConduitT () Event m ())
-> ConduitT () Event m () -> ConduitT () Event m ()
forall a b. (a -> b) -> a -> b
$ Text -> ConduitT () Event m ()
forall (m :: * -> *). Monad m => Text -> Source m Event
renderElementDescription Text
elementDescription
Bool -> ConduitT () Event m () -> ConduitT () Event m ()
forall (f :: * -> *). Applicative f => Bool -> f () -> f ()
unless (Text -> Bool
Text.null Text
elementFormat) (ConduitT () Event m () -> ConduitT () Event m ())
-> ConduitT () Event m () -> ConduitT () Event m ()
forall a b. (a -> b) -> a -> b
$ Text -> ConduitT () Event m ()
forall (m :: * -> *). Monad m => Text -> Source m Event
renderElementFormat Text
elementFormat
Bool -> ConduitT () Event m () -> ConduitT () Event m ()
forall (f :: * -> *). Applicative f => Bool -> f () -> f ()
unless (Text -> Bool
Text.null Text
elementIdentifier) (ConduitT () Event m () -> ConduitT () Event m ())
-> ConduitT () Event m () -> ConduitT () Event m ()
forall a b. (a -> b) -> a -> b
$ Text -> ConduitT () Event m ()
forall (m :: * -> *). Monad m => Text -> Source m Event
renderElementIdentifier Text
elementIdentifier
Bool -> ConduitT () Event m () -> ConduitT () Event m ()
forall (f :: * -> *). Applicative f => Bool -> f () -> f ()
unless (Text -> Bool
Text.null Text
elementLanguage) (ConduitT () Event m () -> ConduitT () Event m ())
-> ConduitT () Event m () -> ConduitT () Event m ()
forall a b. (a -> b) -> a -> b
$ Text -> ConduitT () Event m ()
forall (m :: * -> *). Monad m => Text -> Source m Event
renderElementLanguage Text
elementLanguage
Bool -> ConduitT () Event m () -> ConduitT () Event m ()
forall (f :: * -> *). Applicative f => Bool -> f () -> f ()
unless (Text -> Bool
Text.null Text
elementPublisher) (ConduitT () Event m () -> ConduitT () Event m ())
-> ConduitT () Event m () -> ConduitT () Event m ()
forall a b. (a -> b) -> a -> b
$ Text -> ConduitT () Event m ()
forall (m :: * -> *). Monad m => Text -> Source m Event
renderElementPublisher Text
elementPublisher
Bool -> ConduitT () Event m () -> ConduitT () Event m ()
forall (f :: * -> *). Applicative f => Bool -> f () -> f ()
unless (Text -> Bool
Text.null Text
elementRelation) (ConduitT () Event m () -> ConduitT () Event m ())
-> ConduitT () Event m () -> ConduitT () Event m ()
forall a b. (a -> b) -> a -> b
$ Text -> ConduitT () Event m ()
forall (m :: * -> *). Monad m => Text -> Source m Event
renderElementRelation Text
elementRelation
Bool -> ConduitT () Event m () -> ConduitT () Event m ()
forall (f :: * -> *). Applicative f => Bool -> f () -> f ()
unless (Text -> Bool
Text.null Text
elementRights) (ConduitT () Event m () -> ConduitT () Event m ())
-> ConduitT () Event m () -> ConduitT () Event m ()
forall a b. (a -> b) -> a -> b
$ Text -> ConduitT () Event m ()
forall (m :: * -> *). Monad m => Text -> Source m Event
renderElementRights Text
elementRights
Bool -> ConduitT () Event m () -> ConduitT () Event m ()
forall (f :: * -> *). Applicative f => Bool -> f () -> f ()
unless (Text -> Bool
Text.null Text
elementSource) (ConduitT () Event m () -> ConduitT () Event m ())
-> ConduitT () Event m () -> ConduitT () Event m ()
forall a b. (a -> b) -> a -> b
$ Text -> ConduitT () Event m ()
forall (m :: * -> *). Monad m => Text -> Source m Event
renderElementSource Text
elementSource
Bool -> ConduitT () Event m () -> ConduitT () Event m ()
forall (f :: * -> *). Applicative f => Bool -> f () -> f ()
unless (Text -> Bool
Text.null Text
elementSubject) (ConduitT () Event m () -> ConduitT () Event m ())
-> ConduitT () Event m () -> ConduitT () Event m ()
forall a b. (a -> b) -> a -> b
$ Text -> ConduitT () Event m ()
forall (m :: * -> *). Monad m => Text -> Source m Event
renderElementSubject Text
elementSubject
Bool -> ConduitT () Event m () -> ConduitT () Event m ()
forall (f :: * -> *). Applicative f => Bool -> f () -> f ()
unless (Text -> Bool
Text.null Text
elementTitle) (ConduitT () Event m () -> ConduitT () Event m ())
-> ConduitT () Event m () -> ConduitT () Event m ()
forall a b. (a -> b) -> a -> b
$ Text -> ConduitT () Event m ()
forall (m :: * -> *). Monad m => Text -> Source m Event
renderElementTitle Text
elementTitle
Bool -> ConduitT () Event m () -> ConduitT () Event m ()
forall (f :: * -> *). Applicative f => Bool -> f () -> f ()
unless (Text -> Bool
Text.null Text
elementType) (ConduitT () Event m () -> ConduitT () Event m ())
-> ConduitT () Event m () -> ConduitT () Event m ()
forall a b. (a -> b) -> a -> b
$ Text -> ConduitT () Event m ()
forall (m :: * -> *). Monad m => Text -> Source m Event
renderElementType Text
elementType
newtype DublinCoreModule a = DublinCoreModule a
instance ParseRssExtension a => ParseRssExtension (DublinCoreModule a) where
parseRssChannelExtension :: ConduitT Event o m (RssChannelExtension (DublinCoreModule a))
parseRssChannelExtension = ZipConduit Event o m (RssChannelExtension (DublinCoreModule a))
-> ConduitT Event o m (RssChannelExtension (DublinCoreModule a))
forall i o (m :: * -> *) r. ZipConduit i o m r -> ConduitT i o m r
getZipConduit (ZipConduit Event o m (RssChannelExtension (DublinCoreModule a))
-> ConduitT Event o m (RssChannelExtension (DublinCoreModule a)))
-> ZipConduit Event o m (RssChannelExtension (DublinCoreModule a))
-> ConduitT Event o m (RssChannelExtension (DublinCoreModule a))
forall a b. (a -> b) -> a -> b
$ DcMetaData
-> RssChannelExtension a
-> RssChannelExtension (DublinCoreModule a)
forall a.
DcMetaData
-> RssChannelExtension a
-> RssChannelExtension (DublinCoreModule a)
DublinCoreChannel
(DcMetaData
-> RssChannelExtension a
-> RssChannelExtension (DublinCoreModule a))
-> ZipConduit Event o m DcMetaData
-> ZipConduit
Event
o
m
(RssChannelExtension a -> RssChannelExtension (DublinCoreModule a))
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> ConduitT Event o m DcMetaData -> ZipConduit Event o m DcMetaData
forall i o (m :: * -> *) r. ConduitT i o m r -> ZipConduit i o m r
ZipConduit ConduitT Event o m DcMetaData
forall (m :: * -> *) o.
MonadThrow m =>
ConduitT Event o m DcMetaData
dcMetadata
ZipConduit
Event
o
m
(RssChannelExtension a -> RssChannelExtension (DublinCoreModule a))
-> ZipConduit Event o m (RssChannelExtension a)
-> ZipConduit Event o m (RssChannelExtension (DublinCoreModule a))
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> ConduitT Event o m (RssChannelExtension a)
-> ZipConduit Event o m (RssChannelExtension a)
forall i o (m :: * -> *) r. ConduitT i o m r -> ZipConduit i o m r
ZipConduit ConduitT Event o m (RssChannelExtension a)
forall a (m :: * -> *) o.
(ParseRssExtension a, MonadThrow m) =>
ConduitT Event o m (RssChannelExtension a)
parseRssChannelExtension
parseRssItemExtension :: ConduitT Event o m (RssItemExtension (DublinCoreModule a))
parseRssItemExtension = ZipConduit Event o m (RssItemExtension (DublinCoreModule a))
-> ConduitT Event o m (RssItemExtension (DublinCoreModule a))
forall i o (m :: * -> *) r. ZipConduit i o m r -> ConduitT i o m r
getZipConduit (ZipConduit Event o m (RssItemExtension (DublinCoreModule a))
-> ConduitT Event o m (RssItemExtension (DublinCoreModule a)))
-> ZipConduit Event o m (RssItemExtension (DublinCoreModule a))
-> ConduitT Event o m (RssItemExtension (DublinCoreModule a))
forall a b. (a -> b) -> a -> b
$ DcMetaData
-> RssItemExtension a -> RssItemExtension (DublinCoreModule a)
forall a.
DcMetaData
-> RssItemExtension a -> RssItemExtension (DublinCoreModule a)
DublinCoreItem
(DcMetaData
-> RssItemExtension a -> RssItemExtension (DublinCoreModule a))
-> ZipConduit Event o m DcMetaData
-> ZipConduit
Event
o
m
(RssItemExtension a -> RssItemExtension (DublinCoreModule a))
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> ConduitT Event o m DcMetaData -> ZipConduit Event o m DcMetaData
forall i o (m :: * -> *) r. ConduitT i o m r -> ZipConduit i o m r
ZipConduit ConduitT Event o m DcMetaData
forall (m :: * -> *) o.
MonadThrow m =>
ConduitT Event o m DcMetaData
dcMetadata
ZipConduit
Event
o
m
(RssItemExtension a -> RssItemExtension (DublinCoreModule a))
-> ZipConduit Event o m (RssItemExtension a)
-> ZipConduit Event o m (RssItemExtension (DublinCoreModule a))
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> ConduitT Event o m (RssItemExtension a)
-> ZipConduit Event o m (RssItemExtension a)
forall i o (m :: * -> *) r. ConduitT i o m r -> ZipConduit i o m r
ZipConduit ConduitT Event o m (RssItemExtension a)
forall a (m :: * -> *) o.
(ParseRssExtension a, MonadThrow m) =>
ConduitT Event o m (RssItemExtension a)
parseRssItemExtension
instance RenderRssExtension a => RenderRssExtension (DublinCoreModule a) where
renderRssChannelExtension :: RssChannelExtension (DublinCoreModule a) -> ConduitT () Event m ()
renderRssChannelExtension DublinCoreChannel{..} = do
DcMetaData -> ConduitT () Event m ()
forall (m :: * -> *).
Monad m =>
DcMetaData -> ConduitT () Event m ()
renderDcMetadata DcMetaData
channelDcMetaData
RssChannelExtension a -> ConduitT () Event m ()
forall e (m :: * -> *).
(RenderRssExtension e, Monad m) =>
RssChannelExtension e -> ConduitT () Event m ()
renderRssChannelExtension RssChannelExtension a
channelDcOther
renderRssItemExtension :: RssItemExtension (DublinCoreModule a) -> ConduitT () Event m ()
renderRssItemExtension DublinCoreItem{..} = do
DcMetaData -> ConduitT () Event m ()
forall (m :: * -> *).
Monad m =>
DcMetaData -> ConduitT () Event m ()
renderDcMetadata DcMetaData
itemDcMetaData
RssItemExtension a -> ConduitT () Event m ()
forall e (m :: * -> *).
(RenderRssExtension e, Monad m) =>
RssItemExtension e -> ConduitT () Event m ()
renderRssItemExtension RssItemExtension a
itemDcOther
data instance (DublinCoreModule a) = DublinCoreChannel
{ RssChannelExtension (DublinCoreModule a) -> DcMetaData
channelDcMetaData :: DcMetaData
, RssChannelExtension (DublinCoreModule a) -> RssChannelExtension a
channelDcOther :: RssChannelExtension a
}
deriving instance Eq (RssChannelExtension a) => Eq (RssChannelExtension (DublinCoreModule a))
deriving instance Ord (RssChannelExtension a) => Ord (RssChannelExtension (DublinCoreModule a))
deriving instance Read (RssChannelExtension a) => Read (RssChannelExtension (DublinCoreModule a))
deriving instance Show (RssChannelExtension a) => Show (RssChannelExtension (DublinCoreModule a))
deriving instance Generic (RssChannelExtension a) => Generic (RssChannelExtension (DublinCoreModule a))
data instance (DublinCoreModule a) = DublinCoreItem
{ RssItemExtension (DublinCoreModule a) -> DcMetaData
itemDcMetaData :: DcMetaData
, RssItemExtension (DublinCoreModule a) -> RssItemExtension a
itemDcOther :: RssItemExtension a
}
deriving instance Eq (RssItemExtension a) => Eq (RssItemExtension (DublinCoreModule a))
deriving instance Ord (RssItemExtension a) => Ord (RssItemExtension (DublinCoreModule a))
deriving instance Read (RssItemExtension a) => Read (RssItemExtension (DublinCoreModule a))
deriving instance Show (RssItemExtension a) => Show (RssItemExtension (DublinCoreModule a))
deriving instance Generic (RssItemExtension a) => Generic (RssItemExtension (DublinCoreModule a))