[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:57 UTC 2010
The following commit has been merged in the master branch:
commit b92024c1cbac2a4c3b479f71aeea04d28dad16f0
Author: John Goerzen <jgoerzen at complete.org>
Date: Mon Nov 15 12:08:21 2004 +0100
Added more generic stuff with printf and numbers
Keywords:
(jgoerzen at complete.org--projects/missingh--head--0.5--patch-52)
diff --git a/ChangeLog b/ChangeLog
index d97d284..a2bc131 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 05:08:21 GMT John Goerzen <jgoerzen at complete.org> patch-52
+
+ Summary:
+ Added more generic stuff with printf and numbers
+ Revision:
+ missingh--head--0.5--patch-52
+
+
+ modified files:
+ ChangeLog Makefile libsrc/MissingH/Printf/Types.hs
+
+
2004-11-15 04:47:25 GMT John Goerzen <jgoerzen at complete.org> patch-51
Summary:
diff --git a/Makefile b/Makefile
index 2e62cc6..e47c227 100644
--- a/Makefile
+++ b/Makefile
@@ -33,10 +33,10 @@ libmissingH.a: $(OBJS)
ar q libmissingH.a $(OBJS)
%.o: %.hs
- ghc -fglasgow-exts -ilibsrc --make `echo $< | sed -e s,libsrc/,, -e s,.hs$$,, -e s,/,.,g`
+ ghc -fallow-overlapping-instances -fallow-undecidable-instances -fglasgow-exts -ilibsrc --make `echo $< | sed -e s,libsrc/,, -e s,.hs$$,, -e s,/,.,g`
%.o: %.lhs
- ghc -fglasgow-exts -ilibsrc --make `echo $< | sed -e s,libsrc/,, -e s,.lhs$$,, -e s,/,.,g`
+ ghc -fallow-overlapping-instances -fallow-undecidable-instances -fglasgow-exts -ilibsrc --make `echo $< | sed -e s,libsrc/,, -e s,.lhs$$,, -e s,/,.,g`
doc:
-rm -rf html
@@ -51,19 +51,19 @@ clean:
`find . -name "*~"` *.a setup dist testsrc/runtests
testsrc/runtests: all $(shell find testsrc -name "*.hs")
- ghc6 -package HUnit --make -o testsrc/runtests -itestsrc -ilibsrc testsrc/runtests.hs
+ ghc6 -fallow-overlapping-instances -fallow-undecidable-instances -fglasgow-exts -package HUnit --make -o testsrc/runtests -itestsrc -ilibsrc testsrc/runtests.hs
test-ghc6: testsrc/runtests
testsrc/runtests
test-hugs:
- runhugs -98 -P:$(PWD)/libsrc:$(PWD)/testsrc testsrc/runtests.hs
+ runhugs -98 +o -P:$(PWD)/libsrc:$(PWD)/testsrc testsrc/runtests.hs
interact-hugs:
- hugs -98 -P:$(PWD)/libsrc
+ hugs -98 +o -P:$(PWD)/libsrc
interact-ghci: all
- ghci -ilibsrc
+ ghci -fallow-overlapping-instances -fallow-undecidable-instances -fglasgow-exts -ilibsrc
interact: interact-hugs
diff --git a/libsrc/MissingH/Printf/Types.hs b/libsrc/MissingH/Printf/Types.hs
index 36f18e7..0a488c4 100644
--- a/libsrc/MissingH/Printf/Types.hs
+++ b/libsrc/MissingH/Printf/Types.hs
@@ -3,25 +3,37 @@
module MissingH.Printf.Types where
import System.IO
+import Data.Ratio
data Wrapped a = Wrapped a
data Value =
- ValueInteger Integer
+ ValueRational Rational
| ValueString String
| ValueChar Char
- | ValueDouble Double
deriving (Eq, Show)
class PFType a where
toValue :: a -> Value
fromValue :: Value -> a
+instance Real a => PFType a where
+ toValue = toValue . toRational
+ fromValue = error "fromValue to generic Real not supported"--fromRational . fromValue
+
instance PFType Integer where
- toValue = ValueInteger
- fromValue (ValueInteger x) = x
+ toValue = ValueRational . toRational
+ fromValue (ValueRational x) =
+ if denominator x == 1
+ then toInteger $ numerator x
+ else error ("Can't make an int from non-integral rational " ++ show x)
fromValue _ = error "fromValue integer"
+instance PFType Double where
+ toValue = ValueRational . toRational
+ fromValue (ValueRational x) = fromRational x
+ fromValue _ = error "fromValue Double"
+
instance PFType String where
toValue = ValueString
fromValue (ValueString x) = x
@@ -32,11 +44,12 @@ instance PFType Char where
fromValue (ValueChar x) = x
fromValue _ = error "fromValue char"
+{-
instance PFType Double where
toValue = ValueDouble
fromValue (ValueDouble x) = x
fromValue _ = error "fromValue Double"
-
+-}
{-
instance PFType Value where
toValue = id
--
haskell-testpack
More information about the Pkg-haskell-commits
mailing list