[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:47:06 UTC 2010
The following commit has been merged in the master branch:
commit 35421cab395f179976db302f98fdea6d5d630660
Author: John Goerzen <jgoerzen at complete.org>
Date: Tue Nov 16 02:12:34 2004 +0100
Checkpointing
Keywords:
(jgoerzen at complete.org--projects/missingh--head--0.5--patch-60)
diff --git a/ChangeLog b/ChangeLog
index 473e45d..7cde91d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -2,6 +2,21 @@
# arch-tag: automatic-ChangeLog--jgoerzen at complete.org--projects/missingh--head--0.5
#
+2004-11-15 19:12:34 GMT John Goerzen <jgoerzen at complete.org> patch-60
+
+ Summary:
+ Checkpointing
+ Revision:
+ missingh--head--0.5--patch-60
+
+
+ new files:
+ libsrc/MissingH/Varargs.hs
+
+ modified files:
+ ChangeLog libsrc/MissingH/Printf/Types.hs
+
+
2004-11-15 15:48:48 GMT John Goerzen <jgoerzen at complete.org> patch-59
Summary:
diff --git a/libsrc/MissingH/Printf/Types.hs b/libsrc/MissingH/Printf/Types.hs
index ea515af..0c9c677 100644
--- a/libsrc/MissingH/Printf/Types.hs
+++ b/libsrc/MissingH/Printf/Types.hs
@@ -103,7 +103,10 @@ class PFRun a where
instance PFRun String where
pfrun f = f $ []
instance (PFType a, PFRun b) => PFRun (a -> b) where
- pfrun f x = pfrun (\xs -> f (toValue x : xs))
+ pfrun f x =
+ let nextfunc xs = f ((toValue x) : xs)
+ in
+ pfrun nextfunc
class IOPFRun a where
iopfrun :: Handle -> ([Value] -> String) -> a
diff --git a/libsrc/MissingH/Varargs.hs b/libsrc/MissingH/Varargs.hs
new file mode 100644
index 0000000..594125b
--- /dev/null
+++ b/libsrc/MissingH/Varargs.hs
@@ -0,0 +1,68 @@
+{- arch-tag: Varargs main file
+Copyright (C) 2004 John Goerzen <jgoerzen at complete.org>
+
+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.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+-}
+
+{- |
+ Module : MissingH.Varargs
+ Copyright : Copyright (C) 2004 John Goerzen
+ License : GNU GPL, version 2 or above
+
+ Maintainer : John Goerzen,
+ Maintainer : jgoerzen at complete.org
+ Stability : provisional
+ Portability: portable
+
+
+Copyright (c) 2004 John Goerzen, jgoerzen\@complete.org
+
+Inspiration and ideas from haskell-xml-rpc by Bjorn Bringert
+
+-}
+
+module MissingH.Varargs where
+
+import Data.Dynamic
+import Data.Typeable
+
+isfunc :: Typeable a => a -> Bool
+isfunc x = (length $ typerepArgs $ typeOf x) > 1
+
+
+--callit :: (a -> b) -> ([b] -> c) -> c
+--callit :: Typeable (a, b, c, d) => (a -> b) -> c -> d
+
+data EndOrRecurse a b = Recurse (a -> EndOrRecurse a b)
+ | End b
+ deriving (Eq, Typeable)
+
+printeor :: EndOrRecurse a String -> String
+printeor (End x) = "End " ++ x
+printeor (Recurse _) = "Recurse"
+
+--toeor :: (Typeable a, Typeable b, Typeable c, Typeable (EndOrRecurse b c)) => a -> EndOrRecurse b c
+toeor f =
+ let d = toDyn f
+ in
+ if isfunc f then
+ Recurse (case fromDynamic d of
+ Nothing -> error "Couldn't get func back for recurse"
+ Just x -> x)
+ else End (case fromDynamic d of
+ Nothing -> error "Couldn't get item back for end"
+ Just x -> x)
+
+test = (toeor "foo")::EndOrRecurse String String
--
haskell-testpack
More information about the Pkg-haskell-commits
mailing list