diff options
author | Stephen Paul Weber <singpolyma@singpolyma.net> | 2013-01-02 11:41:06 -0500 |
---|---|---|
committer | Stephen Paul Weber <singpolyma@singpolyma.net> | 2013-01-02 11:41:06 -0500 |
commit | a9e3593f6f45638447de0238a48f15883324321d (patch) | |
tree | 7455d18f14bfb5f28608b54535584cf5b2521921 | |
parent | d9651545a5e0f4b4f6498caa3f4a1c9e2a1f3be2 (diff) |
Monoid instance for Message
-rw-r--r-- | Data/OpenPGP.hs | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/Data/OpenPGP.hs b/Data/OpenPGP.hs index 9a50fa0..0df2e98 100644 --- a/Data/OpenPGP.hs +++ b/Data/OpenPGP.hs | |||
@@ -67,6 +67,7 @@ import Numeric | |||
67 | import Control.Monad | 67 | import Control.Monad |
68 | import Control.Arrow | 68 | import Control.Arrow |
69 | import Control.Applicative | 69 | import Control.Applicative |
70 | import Data.Monoid | ||
70 | import Data.Bits | 71 | import Data.Bits |
71 | import Data.Word | 72 | import Data.Word |
72 | import Data.Char | 73 | import Data.Char |
@@ -883,6 +884,10 @@ instance BINARY_CLASS Message where | |||
883 | put (Message xs) = mapM_ put xs | 884 | put (Message xs) = mapM_ put xs |
884 | get = fmap Message listUntilEnd | 885 | get = fmap Message listUntilEnd |
885 | 886 | ||
887 | instance Monoid Message where | ||
888 | mempty = Message [] | ||
889 | mappend (Message a) (Message b) = Message (a ++ b) | ||
890 | |||
886 | -- | Extract all signature and data packets from a 'Message' | 891 | -- | Extract all signature and data packets from a 'Message' |
887 | signatures_and_data :: Message -> ([Packet], [Packet]) | 892 | signatures_and_data :: Message -> ([Packet], [Packet]) |
888 | signatures_and_data (Message ((CompressedDataPacket {message = m}):_)) = | 893 | signatures_and_data (Message ((CompressedDataPacket {message = m}):_)) = |