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


The following commit has been merged in the master branch:
commit 12900f65b0b0b8658835a7b5eb208963270b118a
Author: John Goerzen <jgoerzen at complete.org>
Date:   Sun Nov 14 03:59:35 2004 +0100

    Have a working prototype
    
    Keywords:
    
    
    (jgoerzen at complete.org--projects/missingh--head--0.5--patch-28)

diff --git a/ChangeLog b/ChangeLog
index 7a7aa88..f2b2d52 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -2,6 +2,18 @@
 # arch-tag: automatic-ChangeLog--jgoerzen at complete.org--projects/missingh--head--0.5
 #
 
+2004-11-13 20:59:35 GMT	John Goerzen <jgoerzen at complete.org>	patch-28
+
+    Summary:
+      Have a working prototype
+    Revision:
+      missingh--head--0.5--patch-28
+
+
+    modified files:
+     ChangeLog libsrc/MissingH/Printf.hs
+
+
 2004-11-13 20:41:25 GMT	John Goerzen <jgoerzen at complete.org>	patch-27
 
     Summary:
diff --git a/libsrc/MissingH/Printf.hs b/libsrc/MissingH/Printf.hs
index b3634b4..e0156b4 100644
--- a/libsrc/MissingH/Printf.hs
+++ b/libsrc/MissingH/Printf.hs
@@ -32,10 +32,16 @@ Written by John Goerzen, jgoerzen\@complete.org
 -}
 
 module MissingH.Printf(sprintf,
-                       Value(..)
-
+                       Value(..),
+                       PFRun(..),
+                       PFCall(..),
+                       PFType(..),
+                       wrapper
                        ) where
 
+-- THIS WORKS:
+-- Prelude MissingH.Printf> (pfrun (wrapper "text%!") "asdf" (5::Int))::String
+
 import MissingH.Str
 import Data.List
 
@@ -75,8 +81,8 @@ instance (PFType a, PFFun b) => PFFun (a -> b) where
 class PFRun a where
     pfrun :: ([Value] -> Value) -> a
 
---instance PFType a => PFRun a where
---    pfrun f = f . fromValue
+instance PFRun String where
+    pfrun f = fromValue $ f []
 
 instance (PFType a, PFRun b) => PFRun (a -> b) where
     pfrun f x = pfrun (\xs -> f (toValue x : xs))
@@ -98,6 +104,9 @@ sprintf ('%' : xs) (y : ys) = (fromValue y) ++ sprintf xs ys
 sprintf ('!' : xs) (y : ys) = show (((fromValue y)::Int) + 1) ++ sprintf xs ys
 sprintf (x:xs) y = x : sprintf xs y
 
+wrapper :: String -> [Value] -> Value
+wrapper f v = toValue $ sprintf f v
+
 {-
 wrapper :: String -> [PFType] -> String
 wrapper x v = sprintf x (map toValue v)

-- 
haskell-testpack



More information about the Pkg-haskell-commits mailing list