[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:11:42 UTC 2010
The following commit has been merged in the master branch:
commit ac89ae020493989feca5d552649ee66e59514e8b
Author: John Goerzen <jgoerzen at complete.org>
Date: Tue Oct 10 21:38:04 2006 +0100
Split into two different class types
diff --git a/MissingH/ProgressTracker.hs b/MissingH/ProgressTracker.hs
index 5ef2ac6..52a6ce9 100644
--- a/MissingH/ProgressTracker.hs
+++ b/MissingH/ProgressTracker.hs
@@ -33,7 +33,7 @@ Written by John Goerzen, jgoerzen\@complete.org
module MissingH.ProgressTracker (ProgressStatus(..),
Progress,
- ProgressTypes(..)
+ ProgressStatuses(..)
)
where
@@ -58,19 +58,26 @@ data ProgressRecord =
newtype Progress = Progress (MVar ProgressRecord)
-class ProgressTypes a b where
+class ProgressStatuses a b where
withStatus :: a -> (ProgressStatus -> b) -> b
+
+class ProgressRecords a b where
withRecord :: a -> (ProgressRecord -> b) -> b
-instance ProgressTypes ProgressRecord b where
+instance ProgressStatuses ProgressRecord b where
withStatus x func = func (status x)
+instance ProgressRecords ProgressRecord b where
withRecord x func = func x
-instance ProgressTypes Progress (IO b) where
+instance ProgressStatuses Progress (IO b) where
withStatus (Progress x) func = withMVar x (\y -> func (status y))
+instance ProgressRecords Progress (IO b) where
withRecord (Progress x) func = withMVar x func
-now :: ProgressTypes a ProgressTimeSource => a -> ProgressTimeSource
+instance ProgressStatuses ProgressStatus b where
+ withStatus x func = func x
+
+now :: ProgressRecords a ProgressTimeSource => a -> ProgressTimeSource
now x = withRecord x timeSource
new :: IO Progress
--
haskell-testpack
More information about the Pkg-haskell-commits
mailing list