[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:46:30 UTC 2010


The following commit has been merged in the master branch:
commit 361665b74d065b853ace4371b9d548f8a906cea8
Author: John Goerzen <jgoerzen at complete.org>
Date:   Sun Nov 14 07:31:43 2004 +0100

    Checkpointing again
    
    Keywords:
    
    
    (jgoerzen at complete.org--projects/missingh--head--0.5--patch-34)

diff --git a/ChangeLog b/ChangeLog
index 00ad012..50e98bb 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -2,6 +2,18 @@
 # arch-tag: automatic-ChangeLog--jgoerzen at complete.org--projects/missingh--head--0.5
 #
 
+2004-11-14 00:31:43 GMT	John Goerzen <jgoerzen at complete.org>	patch-34
+
+    Summary:
+      Checkpointing again
+    Revision:
+      missingh--head--0.5--patch-34
+
+
+    modified files:
+     ChangeLog libsrc/MissingH/Printf.hs
+
+
 2004-11-13 22:40:11 GMT	John Goerzen <jgoerzen at complete.org>	patch-33
 
     Summary:
diff --git a/libsrc/MissingH/Printf.hs b/libsrc/MissingH/Printf.hs
index 3ab3cad..4fad406 100644
--- a/libsrc/MissingH/Printf.hs
+++ b/libsrc/MissingH/Printf.hs
@@ -36,9 +36,11 @@ module MissingH.Printf(
                        PFRun(..),
                        PFType(..),
                        sprintf,
+                       sprintf_real,
 --                       ssprintf,
 --                       printf,
-                       wrapper
+                       wrapper,
+                       v
                        ) where
 
 import MissingH.Str
@@ -47,6 +49,7 @@ import Data.List
 data Value =
            ValueInt Int
            | ValueString String
+             deriving (Eq, Show)
 
 class PFType a where
     toValue :: a -> Value
@@ -62,11 +65,18 @@ instance PFType String where
     fromValue (ValueString x) = x
     fromValue _ = error "fromValue string"
 
+instance PFType Value where
+    toValue = id
+    fromValue = id
+
+v :: PFType a => a -> Value
+v = toValue
+
 class PFRun a where
     pfrun :: ([Value] -> String) -> a
 
 instance PFRun String where
-    pfrun f = f []
+    pfrun f = f $ []
 
 instance (PFType a, PFRun b) => PFRun (a -> b) where
     pfrun f x = pfrun (\xs -> f (toValue x : xs))
@@ -79,11 +89,14 @@ sprintf_real ('!' : xs) (y : ys) =
     show (((fromValue y)::Int) + 1) ++ sprintf_real xs ys
 sprintf_real (x:xs) y = x : sprintf_real xs y
 
-wrapper :: String -> [Value] -> String
-wrapper f v = sprintf_real f v
+forcestring :: String -> String
+forcestring x = x
+
+wrapper :: String -> [Value] -> Value
+wrapper f v = toValue $ sprintf_real f v
 
 sprintf :: (PFRun a) => String -> a
-sprintf f = pfrun $ wrapper f
+sprintf f = pfrun $ sprintf_real f
 
 --printf :: (PFRun a) => String -> IO a
 --printf = return . sprintf

-- 
haskell-testpack



More information about the Pkg-haskell-commits mailing list