Skip to content

Commit

Permalink
Monoid instance for Message
Browse files Browse the repository at this point in the history
  • Loading branch information
singpolyma committed Jan 2, 2013
1 parent d965154 commit a9e3593
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions Data/OpenPGP.hs
Expand Up @@ -67,6 +67,7 @@ import Numeric
import Control.Monad
import Control.Arrow
import Control.Applicative
import Data.Monoid
import Data.Bits
import Data.Word
import Data.Char
Expand Down Expand Up @@ -883,6 +884,10 @@ instance BINARY_CLASS Message where
put (Message xs) = mapM_ put xs
get = fmap Message listUntilEnd

instance Monoid Message where
mempty = Message []
mappend (Message a) (Message b) = Message (a ++ b)

-- | Extract all signature and data packets from a 'Message'
signatures_and_data :: Message -> ([Packet], [Packet])
signatures_and_data (Message ((CompressedDataPacket {message = m}):_)) =
Expand Down

0 comments on commit a9e3593

Please sign in to comment.