Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ binary-x.x.x.x

TODO: fix since annotations

- Change `Binary` instances for `Float` and `Double` to use IEEE754 encoding.
- Add `Data.Binary.Get.getShortByteString`
- Don't reexport `Data.Word` from `Data.Binary`
- Add `Binary (Proxy a)` instance
Expand Down
18 changes: 6 additions & 12 deletions src/Data/Binary/Class.hs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
{-# LANGUAGE PatternGuards #-}
{-# LANGUAGE PolyKinds #-}
{-# LANGUAGE UndecidableInstances #-}
{-# LANGUAGE Trustworthy #-}

Check warning on line 10 in src/Data/Binary/Class.hs

View workflow job for this annotation

GitHub Actions / ghc (8.0.2)

‘Data.Binary.Class’ is marked as Trustworthy but has been inferred as safe!

Check warning on line 10 in src/Data/Binary/Class.hs

View workflow job for this annotation

GitHub Actions / ghc (8.0.2)

‘Data.Binary.Class’ is marked as Trustworthy but has been inferred as safe!

#if MIN_VERSION_base(4,10,0)
{-# LANGUAGE MultiWayIf #-}
Expand Down Expand Up @@ -744,21 +744,15 @@
------------------------------------------------------------------------
-- Floating point

-- | Uses non-IEEE754 encoding. Does not round-trip NaN.
-- | Uses IEEE754 encoding.
instance Binary Double where
put d = put (decodeFloat d)
get = do
x <- get
y <- get
return $! encodeFloat x y
put = putDoublebe
get = getDoublebe

-- | Uses non-IEEE754 encoding. Does not round-trip NaN.
-- | Uses IEEE754 encoding.
instance Binary Float where
put f = put (decodeFloat f)
get = do
x <- get
y <- get
return $! encodeFloat x y
put = putFloatbe
get = getFloatbe

------------------------------------------------------------------------
-- Trees
Expand Down
Loading