Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
Glasgow Haskell Compiler
Packages
binary
Commits
db201353
Commit
db201353
authored
Nov 11, 2015
by
Lennart Kolmodin
Browse files
Merge branch 'feature/void-binary-instance'
parents
0b7abd9f
0adaed92
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/Data/Binary/Class.hs
View file @
db201353
...
...
@@ -8,6 +8,7 @@
#
if
MIN_VERSION_base
(
4
,
8
,
0
)
#
define
HAS_NATURAL
#
define
HAS_VOID
#
endif
#
if
__GLASGOW_HASKELL__
>=
704
...
...
@@ -43,6 +44,9 @@ module Data.Binary.Class (
import
Data.Word
import
Data.Bits
import
Data.Int
#
ifdef
HAS_VOID
import
Data.Void
#
endif
import
Data.Binary.Put
import
Data.Binary.Get
...
...
@@ -128,6 +132,14 @@ class Binary t where
------------------------------------------------------------------------
-- Simple instances
#
ifdef
HAS_VOID
-- Void never gets written nor reconstructed since it's impossible to have a
-- value of that type
instance
Binary
Void
where
put
=
absurd
get
=
mzero
#
endif
-- The () type need never be written to disk: values of singleton type
-- can be reconstructed from the type alone
instance
Binary
()
where
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment