File tree Expand file tree Collapse file tree 3 files changed +23
-0
lines changed Expand file tree Collapse file tree 3 files changed +23
-0
lines changed Original file line number Diff line number Diff line change @@ -246,6 +246,7 @@ Common common
246
246
template-haskell >= 2.13.0.0 && < 2.19 ,
247
247
text >= 0.11.1.0 && < 2.1 ,
248
248
text-manipulate >= 0.2.0.1 && < 0.4 ,
249
+ text-short >= 0.1 && < 0.2 ,
249
250
th-lift-instances >= 0.1.13 && < 0.2 ,
250
251
time >= 1.1.4 && < 1.13 ,
251
252
transformers >= 0.5.2.0 && < 0.6 ,
Original file line number Diff line number Diff line change @@ -55,6 +55,7 @@ module Dhall.Marshal.Decode
55
55
, string
56
56
, lazyText
57
57
, strictText
58
+ , shortText
58
59
-- ** Time
59
60
, timeOfDay
60
61
, day
@@ -176,6 +177,7 @@ import qualified Data.Sequence
176
177
import qualified Data.Set
177
178
import qualified Data.Text
178
179
import qualified Data.Text.Lazy
180
+ import qualified Data.Text.Short
179
181
import qualified Data.Time as Time
180
182
import qualified Data.Vector
181
183
import qualified Dhall.Core as Core
@@ -303,6 +305,9 @@ instance FromDhall Double where
303
305
instance {-# OVERLAPS #-} FromDhall [Char ] where
304
306
autoWith _ = string
305
307
308
+ instance FromDhall Data.Text.Short. ShortText where
309
+ autoWith _ = shortText
310
+
306
311
instance FromDhall Data.Text.Lazy. Text where
307
312
autoWith _ = lazyText
308
313
@@ -912,6 +917,14 @@ double = Decoder {..}
912
917
913
918
expected = pure Double
914
919
920
+ {-| Decode `Data.Text.Short.ShortText`.
921
+
922
+ >>> input shortText "\"Test\""
923
+ "Test"
924
+ -}
925
+ shortText :: Decoder Data.Text.Short. ShortText
926
+ shortText = fmap Data.Text.Short. fromText strictText
927
+
915
928
{-| Decode lazy `Data.Text.Text`.
916
929
917
930
>>> input lazyText "\"Test\""
Original file line number Diff line number Diff line change @@ -83,6 +83,7 @@ import qualified Data.Sequence
83
83
import qualified Data.Set
84
84
import qualified Data.Text
85
85
import qualified Data.Text.Lazy
86
+ import qualified Data.Text.Short
86
87
import qualified Data.Time as Time
87
88
import qualified Data.Vector
88
89
import qualified Data.Void
@@ -166,6 +167,14 @@ instance ToDhall Bool where
166
167
167
168
declared = Bool
168
169
170
+ instance ToDhall Data.Text.Short. ShortText where
171
+ injectWith _ = Encoder {.. }
172
+ where
173
+ embed text =
174
+ TextLit (Chunks [] (Data.Text.Short. toText text))
175
+
176
+ declared = Text
177
+
169
178
instance ToDhall Data.Text.Lazy. Text where
170
179
injectWith _ = Encoder {.. }
171
180
where
You can’t perform that action at this time.
0 commit comments