Skip to content

Commit aad266d

Browse files
authored
Add Binary (Proxy a) instance (#229)
1 parent a0e29ca commit aad266d

2 files changed

Lines changed: 7 additions & 1 deletion

File tree

changelog.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
binary
22
======
33

4-
binary-0.9.0.0
4+
binary-x.x.x.x
55
--------------
66

77
- Don't reexport `Data.Word` from `Data.Binary`
8+
- Add `Binary (Proxy a)` instance
89

910
binary-0.8.9.2
1011
--------------

src/Data/Binary/Class.hs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ import Data.Word
5151
import Data.Bits
5252
import Data.Int
5353
import Data.Complex (Complex(..))
54+
import Data.Proxy (Proxy(..))
5455
#ifdef HAS_VOID
5556
import Data.Void
5657
#endif
@@ -194,6 +195,10 @@ instance Binary () where
194195
put () = mempty
195196
get = return ()
196197

198+
instance Binary (Proxy a) where
199+
put Proxy = pure ()
200+
get = pure Proxy
201+
197202
-- Bools are encoded as a byte in the range 0 .. 1
198203
instance Binary Bool where
199204
put = putWord8 . fromIntegral . fromEnum

0 commit comments

Comments
 (0)