pandocz-0.0.1: src/Text/Pandoc/Z/Text.hs
{-# OPTIONS_GHC -Wall #-}
{-# LANGUAGE FlexibleInstances #-}
module Text.Pandoc.Z.Text where
import Control.Lens
import Data.Text
import qualified Data.Text.Lazy as Lazy
import qualified Text.Pandoc.Definition as D
class HasText a where
text ::
Lens' a Text
instance HasText Text where
text =
id
instance HasText Lazy.Text where
text =
iso
Lazy.toStrict
Lazy.fromStrict
instance HasText D.Format where
text =
iso
(\(D.Format x) -> x)
D.Format
instance HasText [Char] where
text =
iso
pack
unpack
class HasLazyText a where
lazyText ::
Lens' a Lazy.Text
instance HasLazyText Lazy.Text where
lazyText =
id
instance HasLazyText Text where
lazyText =
iso
Lazy.fromStrict
Lazy.toStrict
instance HasLazyText D.Format where
lazyText =
text . lazyText
instance HasLazyText [Char] where
lazyText =
iso
Lazy.pack
Lazy.unpack
class AsText a where
_Text ::
Prism' a Text
instance AsText Text where
_Text =
id
instance AsText Lazy.Text where
_Text =
iso
Lazy.toStrict
Lazy.fromStrict
instance AsText D.Format where
_Text =
iso
(\(D.Format x) -> x)
D.Format
instance AsText [Char] where
_Text =
iso
pack
unpack
class AsLazyText a where
_LazyText ::
Prism' a Lazy.Text
instance AsLazyText Lazy.Text where
_LazyText =
id
instance AsLazyText Text where
_LazyText =
iso
Lazy.fromStrict
Lazy.toStrict
instance AsLazyText D.Format where
_LazyText =
_Text . _LazyText
instance AsLazyText [Char] where
_LazyText =
iso
Lazy.pack
Lazy.unpack