octane-0.1.0: library/Octane/Types/Boolean.hs
module Octane.Types.Boolean (Boolean(..)) where
import Octane.Core
newtype Boolean = NewBoolean
{ getBoolean :: Bool
} deriving (Eq, Show)
instance Binary Boolean where
get = do
boolean <- getWord8
if boolean > 1
then fail "out of bounds"
else boolean & fromIntegral & toEnum & NewBoolean & return
put (NewBoolean boolean) = do
boolean & fromEnum & fromIntegral & putWord8