[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:08 UTC 2010
The following commit has been merged in the master branch:
commit badbf45dc9297bbcbc338375673ba8e637f8b34d
Author: John Goerzen <jgoerzen at complete.org>
Date: Tue Nov 16 03:48:27 2004 +0100
Genericized AL
Keywords:
(jgoerzen at complete.org--projects/missingh--head--0.5--patch-63)
diff --git a/ChangeLog b/ChangeLog
index 5f8c119..4c0b3cd 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -2,6 +2,18 @@
# arch-tag: automatic-ChangeLog--jgoerzen at complete.org--projects/missingh--head--0.5
#
+2004-11-15 20:48:27 GMT John Goerzen <jgoerzen at complete.org> patch-63
+
+ Summary:
+ Genericized AL
+ Revision:
+ missingh--head--0.5--patch-63
+
+
+ modified files:
+ ChangeLog libsrc/MissingH/Printf.hs testsrc/Printftest.hs
+
+
2004-11-15 20:41:19 GMT John Goerzen <jgoerzen at complete.org> patch-62
Summary:
diff --git a/libsrc/MissingH/Printf.hs b/libsrc/MissingH/Printf.hs
index 595899a..171a6b7 100644
--- a/libsrc/MissingH/Printf.hs
+++ b/libsrc/MissingH/Printf.hs
@@ -128,12 +128,12 @@ normLookup xs (y : ys) =
_ -> error $ "Problem matching format string at %" ++ xs
alre = mkRegex "^\\(([^)]+)\\)"
-alLookup :: String -> PrintfAL -> (String, String)
-alLookup xs y =
+gLookup :: (String -> a -> Maybe Value) -> String -> a -> (String, String)
+gLookup lookupfunc xs y =
case matchRegexAll alre xs of
Nothing -> error $ "No varname in keyed lookup at %" ++ xs
Just (_, _, remainder, [varname]) ->
- let val = case lookup varname y of
+ let val = case lookupfunc varname y of
Just z -> z
Nothing -> error $
"Failed to find key " ++ varname ++
@@ -158,7 +158,7 @@ sprintfAL :: String -> PrintfAL -> String
sprintfAL [] _ = []
sprintfAL ('%' : '%' : xs) y = '%' : sprintfAL xs y
sprintfAL ('%' : xs) y =
- let (this, remainder) = alLookup xs y
+ let (this, remainder) = (gLookup lookup) xs y
in
this ++ sprintfAL remainder y
sprintfAL (x:xs) y = x : sprintfAL xs y
diff --git a/testsrc/Printftest.hs b/testsrc/Printftest.hs
index fdb72db..5b10691 100644
--- a/testsrc/Printftest.hs
+++ b/testsrc/Printftest.hs
@@ -56,7 +56,7 @@ test_vsprintf_generics =
do
"foo: 5" @=? vsprintf "%s: %d" "foo" (5::Int)
"%foo%:% %-1%\n%" @=? vsprintf "%%%s%%:%% %%%d%%\n%%" "foo" (-1::Integer)
- "baz: 3.140000" @=? vsprintf "%s: %f" "baz" (3.14::Rational)
+ "baz: 3.140000" @=? vsprintf "%s: %f" "baz" (3.14::Rational)
"quux: 3.140000e+02" @=? vsprintf "%s: %e" "quux" (314::Double)
"fe" @=? vsprintf "%x" (254::Int)
"FE" @=? vsprintf "%X" (254::Int)
--
haskell-testpack
More information about the Pkg-haskell-commits
mailing list