packages feed

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

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

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

newtype Fixed32Msg = Fixed32Msg
  { value :: PB.Word32
  } deriving (PB.Show, PB.Eq, PB.Ord)

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

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

instance PB.Required Fixed32Msg where
  reqTags _ = PB.fromList [PB.WireTag 1 PB.Bit32]

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

  messageToFields self = do
    PB.putFixed32 (PB.WireTag 1 PB.Bit32) (value self)