packages feed

protobuf-simple-0.1.0.0: test/Types/BoolMsg.hs

-- Generated by protobuf-simple. DO NOT EDIT!
module Types.BoolMsg where

import Control.Applicative ((<$>))
import Prelude ()
import qualified Data.ProtoBufInt as PB

newtype BoolMsg = BoolMsg
  { value :: PB.Bool
  } deriving (PB.Show, PB.Eq, PB.Ord)

instance PB.Default BoolMsg where
  defaultVal = BoolMsg
    { value = PB.defaultVal
    }

instance PB.Mergeable BoolMsg where
  merge a b = BoolMsg
    { value = PB.merge (value a) (value b)
    }

instance PB.Required BoolMsg where
  reqTags _ = PB.fromList [PB.WireTag 1 PB.VarInt]

instance PB.WireMessage BoolMsg where
  fieldToValue (PB.WireTag 1 PB.VarInt) self = (\v -> self{value = PB.merge (value self) v}) <$> PB.getBool
  fieldToValue tag self = PB.getUnknown tag self

  messageToFields self = do
    PB.putBool (PB.WireTag 1 PB.VarInt) (value self)