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
246246 template-haskell >= 2.13.0.0 && < 2.19 ,
247247 text >= 0.11.1.0 && < 2.1 ,
248248 text-manipulate >= 0.2.0.1 && < 0.4 ,
249+ text-short >= 0.1 && < 0.2 ,
249250 th-lift-instances >= 0.1.13 && < 0.2 ,
250251 time >= 1.1.4 && < 1.13 ,
251252 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
5555 , string
5656 , lazyText
5757 , strictText
58+ , shortText
5859 -- ** Time
5960 , timeOfDay
6061 , day
@@ -176,6 +177,7 @@ import qualified Data.Sequence
176177import qualified Data.Set
177178import qualified Data.Text
178179import qualified Data.Text.Lazy
180+ import qualified Data.Text.Short
179181import qualified Data.Time as Time
180182import qualified Data.Vector
181183import qualified Dhall.Core as Core
@@ -303,6 +305,9 @@ instance FromDhall Double where
303305instance {-# OVERLAPS #-} FromDhall [Char ] where
304306 autoWith _ = string
305307
308+ instance FromDhall Data.Text.Short. ShortText where
309+ autoWith _ = shortText
310+
306311instance FromDhall Data.Text.Lazy. Text where
307312 autoWith _ = lazyText
308313
@@ -912,6 +917,14 @@ double = Decoder {..}
912917
913918 expected = pure Double
914919
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+
915928{-| Decode lazy `Data.Text.Text`.
916929
917930>>> input lazyText "\"Test\""
Original file line number Diff line number Diff line change @@ -83,6 +83,7 @@ import qualified Data.Sequence
8383import qualified Data.Set
8484import qualified Data.Text
8585import qualified Data.Text.Lazy
86+ import qualified Data.Text.Short
8687import qualified Data.Time as Time
8788import qualified Data.Vector
8889import qualified Data.Void
@@ -166,6 +167,14 @@ instance ToDhall Bool where
166167
167168 declared = Bool
168169
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+
169178instance ToDhall Data.Text.Lazy. Text where
170179 injectWith _ = Encoder {.. }
171180 where
You can’t perform that action at this time.
0 commit comments