Update dhall-lang submodule (#1403)
This includes some simplifications/optimizations for the `ToTerm DhallDouble` instance.
Most notably we let `cborg` take care of the correct encoding of NaNs:
See `Codec.CBOR.Write.doubleMP`:
977c0c0820/cborg/src/Codec/CBOR/Write.hs (L571-L573)
This commit is contained in:
parent
9de7ac51a8
commit
5e7794c652
|
@ -1 +1 @@
|
|||
Subproject commit ef644a00e77a3c2c6c503e18e65865fd6d74fc2a
|
||||
Subproject commit f6919fe8844ce9cdab0c6d88eb9393126b56e037
|
|
@ -61,6 +61,8 @@ Extra-Source-Files:
|
|||
dhall-lang/Prelude/List/build
|
||||
dhall-lang/Prelude/List/concat
|
||||
dhall-lang/Prelude/List/concatMap
|
||||
dhall-lang/Prelude/List/default
|
||||
dhall-lang/Prelude/List/empty
|
||||
dhall-lang/Prelude/List/filter
|
||||
dhall-lang/Prelude/List/fold
|
||||
dhall-lang/Prelude/List/generate
|
||||
|
@ -79,6 +81,7 @@ Extra-Source-Files:
|
|||
dhall-lang/Prelude/Location/package.dhall
|
||||
dhall-lang/Prelude/Location/Type
|
||||
dhall-lang/Prelude/Map/Entry
|
||||
dhall-lang/Prelude/Map/empty
|
||||
dhall-lang/Prelude/Map/keys
|
||||
dhall-lang/Prelude/Map/map
|
||||
dhall-lang/Prelude/Map/package.dhall
|
||||
|
@ -107,6 +110,7 @@ Extra-Source-Files:
|
|||
dhall-lang/Prelude/Optional/any
|
||||
dhall-lang/Prelude/Optional/build
|
||||
dhall-lang/Prelude/Optional/concat
|
||||
dhall-lang/Prelude/Optional/default
|
||||
dhall-lang/Prelude/Optional/filter
|
||||
dhall-lang/Prelude/Optional/fold
|
||||
dhall-lang/Prelude/Optional/head
|
||||
|
|
|
@ -465,16 +465,15 @@ instance ToTerm Void where
|
|||
|
||||
instance ToTerm DhallDouble where
|
||||
encode (DhallDouble n64)
|
||||
-- cborg always encodes NaN as "7e00"
|
||||
| isNaN n64 = THalf n32
|
||||
-- cborg always encodes NaN as a half-precision float of value "7e00"
|
||||
| useHalf = THalf n32
|
||||
| useFloat = TFloat n32
|
||||
| otherwise = TDouble n64
|
||||
where
|
||||
n32 = double2Float n64
|
||||
useFloat = n64 == float2Double n32
|
||||
-- the other three cases for Half-floats are 0.0 and the infinities
|
||||
useHalf = or $ fmap (n64 ==) [0.0, infinity, -infinity]
|
||||
-- the other four cases for Half-floats are -0.0, 0.0 and the infinities
|
||||
useHalf = n64 == 0.0 || n64 == infinity || n64 == -infinity
|
||||
infinity = 1/0 :: Double
|
||||
|
||||
-- | Types that can be decoded from a CBOR `Term`
|
||||
|
|
Loading…
Reference in New Issue
Block a user