[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 14:54:01 UTC 2010


The following commit has been merged in the master branch:
commit 1dfdb19526e28fd0aaade214dd33bb909e6b218e
Author: John Goerzen <jgoerzen at complete.org>
Date:   Fri Dec 24 08:37:50 2004 +0100

    Documenting
    
    Keywords:
    
    
    (jgoerzen at complete.org--projects/missingh--head--0.7--patch-165)

diff --git a/ChangeLog b/ChangeLog
index bd732b6..99e2a12 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -2,6 +2,20 @@
 # arch-tag: automatic-ChangeLog--jgoerzen at complete.org--projects/missingh--head--0.7
 #
 
+2004-12-24 01:37:50 GMT	John Goerzen <jgoerzen at complete.org>	patch-165
+
+    Summary:
+      Documenting
+    Revision:
+      missingh--head--0.7--patch-165
+
+
+    modified files:
+     ChangeLog Setup.description libsrc/MissingH/IO.hs
+     libsrc/MissingH/IO/HVFS.hs
+     libsrc/MissingH/IO/HVFS/InstanceHelpers.hs
+
+
 2004-12-24 00:02:16 GMT	John Goerzen <jgoerzen at complete.org>	patch-164
 
     Summary:
diff --git a/Setup.description b/Setup.description
index 3188498..3e75d53 100644
--- a/Setup.description
+++ b/Setup.description
@@ -32,6 +32,10 @@ Modules: MissingH.IO, MissingH.IO.Binary, MissingH.List,
   MissingH.FileArchive.GZip,
   MissingH.Threads.Child,
   MissingH.IO.BlockIO,
+  MissingH.IO.HVFS,
+    MissingH.IO.HVFS.Combinators,
+    MissingH.IO.HVFS.InstanceHelpers,
+    MissingH.IO.HVFS.Utils,
   MissingH.Email.Parser,
   MissingH.Wash.Mail.Email,
     MissingH.Wash.Mail.EmailConfig,
diff --git a/libsrc/MissingH/IO.hs b/libsrc/MissingH/IO.hs
index 7fd6056..af5a61d 100644
--- a/libsrc/MissingH/IO.hs
+++ b/libsrc/MissingH/IO.hs
@@ -31,6 +31,9 @@ This module provides various helpful utilities for dealing with I\/O.
 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.
 -}
 
 module MissingH.IO(-- * Entire File\/Handle Utilities
@@ -95,10 +98,10 @@ In other words:
 
 > interact = hInteract stdin stdout
 -}
-hInteract :: Handle -> Handle -> (String -> String) -> IO ()
+hInteract :: (HVIO a, HVIO b) => a -> b -> (String -> String) -> IO ()
 hInteract finput foutput func = do
-                                content <- hGetContents finput
-                                hPutStr foutput (func content)
+                                content <- vGetContents finput
+                                vPutStr foutput (func content)
 
 {- | Line-based interaction.  This is similar to wrapping your
 interact functions with 'lines' and 'unlines'.  This equality holds:
@@ -150,8 +153,9 @@ hCopy hin hout = do
 Takes a function to provide progress updates to the user.
 -}
 
-hCopyProgress :: Integral a => Handle        -- ^ Input handle
-                 -> Handle              -- ^ Output handle
+hCopyProgress :: (HVIO b, HVIO c, Integral a) => 
+                    b        -- ^ Input handle
+                 -> c              -- ^ Output handle
                  -> (Maybe a -> Integer -> Bool -> IO ()) -- ^ Progress function -- the bool is always False unless this is the final call
                  -> Int                 -- Block size
                  -> Maybe a             -- Estimated file size (passed to func)
@@ -165,12 +169,12 @@ hCopyProgress hin hout func bsize estsize =
                 newcount = count + (genericLength block)
                 in
                 do
-                hPutStr hout block
+                vPutStr hout block
                 func estsize count False
                 copyFunc remainder newcount
         in
         do
-        c <- hGetContents hin
+        c <- vGetContents hin
         bytes <- copyFunc c 0
         func estsize bytes True
         return bytes
@@ -181,7 +185,7 @@ Like 'hBlockCopy', this implementation is nice:
 > hLineCopy hin hout = hLineInteract hin hout id
 -}
 
-hLineCopy :: Handle -> Handle -> IO()
+hLineCopy :: (HVIO a, HVIO b) => a -> b -> IO()
 hLineCopy hin hout = hLineInteract hin hout id
 
 {- | Copies from 'stdin' to 'stdout' using lines.  An alias for 'hLineCopy'
diff --git a/libsrc/MissingH/IO/HVFS.hs b/libsrc/MissingH/IO/HVFS.hs
index 1fe818f..53fc534 100644
--- a/libsrc/MissingH/IO/HVFS.hs
+++ b/libsrc/MissingH/IO/HVFS.hs
@@ -30,6 +30,24 @@ Haskell Virtual FS -- generic support for real or virtual filesystem in Haskell
 
 Copyright (c) 2004 John Goerzen, jgoerzen\@complete.org
 
+The idea of this module is to provide virtualization of filesystem calls.
+In addition to the \"real\" system filesystem, you can also provide access
+to other, virtual, filesystems using the same set of calls.  Examples of
+such virtual filesystems might include a remote FTP server, WebDAV server,
+a local Hashtable, a ConfigParser object, or any other data structure
+you can represent as a tree of named nodes containing strings.
+
+Each 'HVFS' function takes a 'HVFS' \"handle\" ('HVFS' instance) as its
+first parameter.  If you wish to operate on the standard system filesystem,
+you can just use 'SystemFS'.
+
+The "MissingH.HVFS.IO.InstanceHelpers" module contains some code to help
+you make your own HVFS instances.
+
+The 'HVFSOpenable' class works together with the "MissingH.IO.HVIO" module
+to provide a complete virtual filesystem and I\/O model that allows you
+to open up virtual filesystem files and act upon them in a manner similar
+to standard Handles.
 -}
 
 module MissingH.IO.HVFS(-- * Implementation Classes \/ Types
diff --git a/libsrc/MissingH/IO/HVFS/InstanceHelpers.hs b/libsrc/MissingH/IO/HVFS/InstanceHelpers.hs
index e33b98d..940f22e 100644
--- a/libsrc/MissingH/IO/HVFS/InstanceHelpers.hs
+++ b/libsrc/MissingH/IO/HVFS/InstanceHelpers.hs
@@ -55,7 +55,8 @@ import System.IO.Error
 import System.IO
 import MissingH.IO.HVIO
 
-{- | A simple class that assumes that everything is either a file
+{- | A simple "MissingH.IO.HVFS.HVFSStat" 
+class that assumes that everything is either a file
 or a directory. -}
 data SimpleStat = SimpleStat {
                               isFile :: Bool, -- ^ True if file, False if directory
@@ -70,10 +71,18 @@ instance HVFSStat SimpleStat where
 -- In-Memory Tree Types
 ----------------------------------------------------------------------
 
+{- | The basic node of a 'MemoryVFS'.  The String corresponds to the filename,
+and the entry to the contents. -}
 type MemoryNode = (String, MemoryEntry)
+
+{- | The content of a file or directory in a 'MemoryVFS'. -}
 data MemoryEntry = MemoryDirectory [MemoryNode]
                  | MemoryFile String
                    deriving (Eq, Show)
+
+{- | An in-memory read\/write filesystem.  Think of it as a dynamically
+resizable ramdisk written in Haskell. -}
+
 data MemoryVFS = MemoryVFS 
                { content :: IORef [MemoryNode],
                  cwd :: IORef FilePath

-- 
haskell-testpack



More information about the Pkg-haskell-commits mailing list