packages feed

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

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

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

newtype MessageList = MessageList
  { value :: PB.Seq Types.Message.Message
  } deriving (PB.Show, PB.Eq, PB.Ord)

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

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

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

instance PB.WireMessage MessageList where
  fieldToValue (PB.WireTag 1 PB.LenDelim) self = (\v -> self{value = PB.append (value self) v}) <$> PB.getMessage
  fieldToValue tag self = PB.getUnknown tag self

  messageToFields self = do
    PB.putMessageList (PB.WireTag 1 PB.LenDelim) (value self)