[Pkg-haskell-commits] [SCM] haskell-testpack branch, master, updated. debian/1.0.2-1-4-gb0d6b36

John Goerzen jgoerzen at complete.org
Fri Apr 23 15:02:51 UTC 2010


The following commit has been merged in the master branch:
commit aa07779c3c2150042d28dfc76f02f15dc20b9702
Author: John Goerzen <jgoerzen at complete.org>
Date:   Sat Oct 1 04:23:33 2005 +0100

    Updated mailbox info

diff --git a/MissingH.cabal b/MissingH.cabal
index be9baea..913f762 100644
--- a/MissingH.cabal
+++ b/MissingH.cabal
@@ -5,7 +5,7 @@ License: GPL
 Maintainer: John Goerzen <jgoerzen at complete.org>
 Stability: Alpha
 Copyright: Copyright (c) 2004-2005 John Goerzen
-Exposed-Modules: MissingH.IO, MissingH.IO.Binary, MissingH.List,
+Exposed-Modules: MissingH.Str, MissingH.IO, MissingH.IO.Binary, MissingH.List,
   MissingH.Daemon,
   MissingH.Email.Mailbox,
   MissingH.Logging, MissingH.Logging.Handler,
@@ -16,7 +16,6 @@ Exposed-Modules: MissingH.IO, MissingH.IO.Binary, MissingH.List,
   MissingH.Hsemail.Rfc2234, MissingH.Hsemail.Rfc2821, 
     MissingH.Hsemail.Rfc2822,
   MissingH.Regex.Pesco,
-  MissingH.Str,
     MissingH.Str.CSV,
   MissingH.Cmd,
   MissingH.FiniteMap, MissingH.Path, MissingH.Path.NameManip,
diff --git a/MissingH/Email/Mailbox.hs b/MissingH/Email/Mailbox.hs
index c34be0b..7072500 100644
--- a/MissingH/Email/Mailbox.hs
+++ b/MissingH/Email/Mailbox.hs
@@ -30,13 +30,12 @@ General support for e-mail mailboxes
 Written by John Goerzen, jgoerzen\@complete.org
 -}
 
-module MissingH.Email.Mailbox(Flag(..), Message, Flags,
+module MissingH.Email.Mailbox(Flag(..), Flags, Message,
                               MailboxReader(..),
                               MailboxWriter(..))
 where
 
-type Message = String
-
+{- | The flags which may be assigned to a message. -}
 data Flag = 
            SEEN
            | ANSWERED
@@ -46,13 +45,40 @@ data Flag =
            | OTHERFLAG String
            deriving (Eq, Show)
            
+{- | Convenience shortcut -}
 type Flags = [Flag]
 
-class (Show a, Show b) => MailboxReader a b where
-    listMessageIDs :: a -> IO [b]
+{- | A Message is represented as a simple String. -}
+type Message = String
+
+{- | Main class for readable mailboxes. 
+
+The mailbox object /a/ represents zero or more 'Message's.  Each message
+has a unique identifier /b/ in a format specific to each given mailbox.
+This identifier may or may not be persistent.
+
+Functions which return a list are encouraged -- but not guaranteed -- to
+do so lazily.
+
+Implementing classes must provide, at minimum, 'getAll'.
+-}
+class (Show a, Show b, Eq b) => MailboxReader a b where
+    {- | Returns a list of all unique identifiers. -}
+    listIDs :: a -> IO [b]
+    {- | Returns a list of all unique identifiers as well as all flags. -}
     listMessageFlags :: a -> IO [(b, Flags)]
+    {- | Returns a list of all messages, including their content,
+       flags, and unique identifiers. -}
     getAll :: a -> IO [(b, Flags, Message)]
+    {- | Returns information about specific messages. -}
     getMessages :: a -> [b] -> IO [(b, Flags, Message)]
+
+    listIDs mb = listMessageFlags mb >>= return . map fst
+    listMessageFlags mb = getAll mb >>= return . 
+                           map (\(i, f, _) -> (i, f))
+    getMessages mb list =
+        do messages <- getAll mb
+           return $ filter (\(id, f, m) -> id `elem` list) messages
     
 class (MailboxReader a b) => MailboxWriter a b where
     appendMessage :: a -> Flags -> Message -> IO b
diff --git a/MissingH/Email/Mailbox.hs b/MissingH/Email/Mailbox/Maildir.hs
similarity index 100%
copy from MissingH/Email/Mailbox.hs
copy to MissingH/Email/Mailbox/Maildir.hs
diff --git a/MissingH/IO.hs b/MissingH/IO.hs
index 86bda4d..6958718 100644
--- a/MissingH/IO.hs
+++ b/MissingH/IO.hs
@@ -1,4 +1,4 @@
-{- arch-tag: I/O utilities main file
+{-
 Copyright (C) 2004-2005 John Goerzen <jgoerzen at complete.org>
 
 This program is free software; you can redistribute it and/or modify
@@ -25,18 +25,10 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
    Stability  : provisional
    Portability: portable
 
-This module provides various helpful utilities for dealing with I\/O
-in Haskell.
-
-There are more functions in "MissingH.IO.Binary".
-
-Written by John Goerzen, jgoerzen\@complete.org
-
-If you\'re not familiar with the "MissingH.IO.HVIO.HVIO" types, don\'t worry;
-you can just use a regular Handle anywhere you see them.
+asdf.
 -}
 
-module MissingH.IO(-- * Entire File\/Handle Utilities
+module MissingH.IO(-- * Entire File Handle Utilities
                        -- ** Opened Handle Data Copying
                        hCopy, hCopyProgress, hLineCopy, lineCopy,
                        -- ** Disk File Data Copying
diff --git a/MissingH/IO/Binary.hs b/MissingH/IO/Binary.hs
index b251ccb..073aaa0 100644
--- a/MissingH/IO/Binary.hs
+++ b/MissingH/IO/Binary.hs
@@ -25,7 +25,8 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
    Stability  : provisional
    Portability: portable to platforms supporting binary I\/O
 
-This module provides various helpful utilities for dealing with I\/O.
+This module provides various helpful utilities for dealing with binary
+input and output.
 
 Important note: /binary functions are not supported in all Haskell
 implementations/.  Do not import or use this module unless you know you
diff --git a/MissingH/Str.hs b/MissingH/Str.hs
index fe5dbb2..86a4530 100644
--- a/MissingH/Str.hs
+++ b/MissingH/Str.hs
@@ -1,7 +1,7 @@
 {- arch-tag: String utilities main file
 Copyright (C) 2004 John Goerzen <jgoerzen at complete.org>
 
-This program is free software; you can redistribute it and/or modify
+This program is free software; you can redistribute it and\/or modify
 it under the terms of the GNU General Public License as published by
 the Free Software Foundation; either version 2 of the License, or
 (at your option) any later version.

-- 
haskell-testpack



More information about the Pkg-haskell-commits mailing list