[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:53:44 UTC 2010


The following commit has been merged in the master branch:
commit 91fb1c523654b910ab8e5c27f1f8857f5b1c8714
Author: John Goerzen <jgoerzen at complete.org>
Date:   Fri Dec 24 00:11:12 2004 +0100

    Eased encapsulation
    
    Keywords:
    
    
    (jgoerzen at complete.org--projects/missingh--head--0.7--patch-154)

diff --git a/ChangeLog b/ChangeLog
index 32a80bd..ab92fbe 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -2,6 +2,18 @@
 # arch-tag: automatic-ChangeLog--jgoerzen at complete.org--projects/missingh--head--0.7
 #
 
+2004-12-23 17:11:12 GMT	John Goerzen <jgoerzen at complete.org>	patch-154
+
+    Summary:
+      Eased encapsulation
+    Revision:
+      missingh--head--0.7--patch-154
+
+
+    modified files:
+     ChangeLog libsrc/MissingH/IO/HVFS.hs
+
+
 2004-12-23 17:06:28 GMT	John Goerzen <jgoerzen at complete.org>	patch-153
 
     Summary:
diff --git a/libsrc/MissingH/IO/HVFS.hs b/libsrc/MissingH/IO/HVFS.hs
index 2d6af84..30d05a1 100644
--- a/libsrc/MissingH/IO/HVFS.hs
+++ b/libsrc/MissingH/IO/HVFS.hs
@@ -61,7 +61,14 @@ typing restrictions.  You can get at it with:
 data HVFSStatEncap = forall a. HVFSStat a => HVFSStatEncap a
 
 {- | Convenience function for working with stat -- takes a stat result
-and a function that uses it, and returns the result. -}
+and a function that uses it, and returns the result. 
+
+Here is an example from the HVFS source:
+
+>    vGetModificationTime fs fp = 
+>       do s <- vGetFileStatus fs fp
+>          return $ TOD (fromIntegral (withStat s vModificationTime)) 0
+-}
 withStat :: forall b. HVFSStatEncap -> (forall a. HVFSStat a => a -> b) -> b
 withStat s f =
     case s of
@@ -172,9 +179,7 @@ class (Show a) => HVFS a where
 
     vGetModificationTime fs fp = 
         do s <- vGetFileStatus fs fp
-           case s of
-                  HVFSStatEncap x -> return $ 
-                                      TOD (fromIntegral (vModificationTime x)) 0
+           return $ TOD (fromIntegral (withStat s vModificationTime)) 0
     vRaiseError _ et desc mfp =
         ioError $ mkIOError et desc Nothing mfp
 
@@ -183,13 +188,11 @@ class (Show a) => HVFS a where
     vGetDirectoryContents fs _ = eh fs "vGetDirectoryContents"
     vDoesFileExist fs fp = 
         catch (do s <- vGetFileStatus fs fp
-                  case s of
-                     HVFSStatEncap x -> return $ vIsRegularFile x
+                  return $ withStat s vIsRegularFile
               ) (\_ -> return False)
     vDoesDirectoryExist fs fp = 
         catch (do s <- vGetFileStatus fs fp
-                  case s of
-                     HVFSStatEncap x -> return $ vIsDirectory x
+                  return $ withStat s vIsDirectory
               ) (\_ -> return False)
     vCreateDirectory fs _ = eh fs "vCreateDirectory"
     vRemoveDirectory fs _ = eh fs "vRemoveDirectory"

-- 
haskell-testpack



More information about the Pkg-haskell-commits mailing list