packages feed

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

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

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

newtype FloatOptMsg = FloatOptMsg
  { value :: PB.Maybe PB.Float
  } deriving (PB.Show, PB.Eq, PB.Ord)

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

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

instance PB.Required FloatOptMsg where
  reqTags _ = PB.fromList []

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

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