[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:25 UTC 2010
The following commit has been merged in the master branch:
commit 7d01f0b19aa033a22560333bce2634b294f376cf
Author: John Goerzen <jgoerzen at complete.org>
Date: Sun Nov 14 04:32:54 2004 +0100
Removed old code
Keywords:
(jgoerzen at complete.org--projects/missingh--head--0.5--patch-31)
diff --git a/ChangeLog b/ChangeLog
index 407890f..72196ac 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 21:32:54 GMT John Goerzen <jgoerzen at complete.org> patch-31
+
+ Summary:
+ Removed old code
+ Revision:
+ missingh--head--0.5--patch-31
+
+
+ modified files:
+ ChangeLog libsrc/MissingH/Printf.hs
+
+
2004-11-13 21:28:50 GMT John Goerzen <jgoerzen at complete.org> patch-30
Summary:
diff --git a/libsrc/MissingH/Printf.hs b/libsrc/MissingH/Printf.hs
index 937d861..4ccb816 100644
--- a/libsrc/MissingH/Printf.hs
+++ b/libsrc/MissingH/Printf.hs
@@ -34,27 +34,18 @@ Written by John Goerzen, jgoerzen\@complete.org
module MissingH.Printf(sprintf,
Value(..),
PFRun(..),
- PFCall(..),
PFType(..),
- doit,
+ sprintf,
wrapper
) where
--- THIS WORKS:
--- Prelude MissingH.Printf> (pfrun (wrapper "text%!") "asdf" (5::Int))::String
-
import MissingH.Str
import Data.List
-class PFFun a where
- toFun :: a -> PFCall -> String
-
data Value =
ValueInt Int
| ValueString String
-data PFCall = PFCall [Value]
-
class PFType a where
toValue :: a -> Value
fromValue :: Value -> a
@@ -69,16 +60,6 @@ instance PFType String where
fromValue (ValueString x) = x
fromValue _ = error "fromValue string"
-
-instance PFFun String where
- toFun x (PFCall []) = x
- toFun _ _ = error "Too many arguments"
-
-instance (PFType a, PFFun b) => PFFun (a -> b) where
- toFun f (PFCall (x:xs)) =
- toFun (f (fromValue x)) (PFCall xs)
- toFun _ _ = error "Too few arguments"
-
class PFRun a where
pfrun :: ([Value] -> Value) -> a
@@ -88,43 +69,19 @@ instance PFRun String where
instance (PFType a, PFRun b) => PFRun (a -> b) where
pfrun f x = pfrun (\xs -> f (toValue x : xs))
-{-
-instance PFFun String where
- toFun [] (PFCall []) = []
- toFun ('%' : xs) (PFCall (y:ys)) =
- y : toFun
- toFun (x:xs) y =
- x : toFun xs y
- -}
-
-{- Sample attempt here -}
-sprintf :: String -> [Value] -> String
+sprintf_real :: String -> [Value] -> String
-sprintf [] [] = []
-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
+sprintf_real [] [] = []
+sprintf_real ('%' : xs) (y : ys) = (fromValue y) ++ sprintf_real xs ys
+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] -> Value
-wrapper f v = toValue $ sprintf f v
+wrapper f v = toValue $ sprintf_real f v
--- doit format v = (pfrun (wrapper format) v)::String
-doit :: PFRun a => String -> a
-doit f = pfrun $ wrapper f
+sprintf :: PFRun a => String -> a
+sprintf f = pfrun $ wrapper f
+
+--printf :: PFRun a => String -> a -> IO ()
-{-
-wrapper :: String -> [PFType] -> String
-wrapper x v = sprintf x (map toValue v)
--}
-{- To try next: define a third pffun instance that itself works off the format string -}
-----------------------------------------------------
-{-
-printf :: String -> PFFun
-printf "" = toFun ""
-printf ('%' : xs) = toFun (\x -> x ++ printf xs)
-printf x =
- case split "%" x of
- [y] -> toFun y
- [y : z] -> toFun (\a -> y ++ a ++ printf (join "%" z))
-
- -}
\ No newline at end of file
--
haskell-testpack
More information about the Pkg-haskell-commits
mailing list