packages feed

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

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

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

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

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

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

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

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

  messageToFields self = do
    PB.putDoubleOpt (PB.WireTag 1 PB.Bit64) (value self)