blob: 81efddbbd1e53ef4dd81c6ddd15ad01b8306136b (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
|
{-# LANGUAGE CPP
, FlexibleInstances
#-}
module Data.Text.Compat where
import Data.Text (Text, pack, unpack)
#if MIN_VERSION_pandoc_types(1, 17, 6)
type PandocStr = Text
#else
type PandocStr = String
#endif
class PS a where
-- Convert from something to a pandoc string
conv :: a -> PandocStr
-- Convert from a pandoc string back into another string type
from :: PandocStr -> a
#if MIN_VERSION_pandoc_types(1, 17, 6)
instance PS Text where
conv = id
from = id
instance PS String where
conv = pack
from = unpack
#else
instance PS Text where
conv = unpack
from = pack
instance PS String where
conv = id
from = id
#endif
|