Skip to content

Commit

Permalink
Merge pull request #10 from jmcarthur/master
Browse files Browse the repository at this point in the history
rewrite rules for realToFrac
  • Loading branch information
jmcarthur committed May 6, 2012
2 parents f8cf86b + 5eea711 commit 1642418
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion include/CTypes.h
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,7 @@ instance Storable T where { \
-- // GHC can derive any class for a newtype, so we make use of that here...

#define INSTANCE_TYPEABLE0(tycon,tcname,str) deriving instance Typeable tycon
#define GHC_RULE(N,R) {-# RULES "N" R #-}

#define ARITHMETIC_CLASSES Eq,Ord,Num,Enum,Storable,Real
#define INTEGRAL_CLASSES Bounded,Integral,Bits
Expand All @@ -196,7 +197,9 @@ INSTANCE_TYPEABLE0(T,C,S) ;
newtype T = T B deriving (ARITHMETIC_CLASSES, FLOATING_CLASSES); \
INSTANCE_READ(T,B); \
INSTANCE_SHOW(T,B); \
INSTANCE_TYPEABLE0(T,C,S) ;
INSTANCE_TYPEABLE0(T,C,S) ; \
GHC_RULE(realToFrac/a->T,realToFrac = \x -> T (realToFrac x)) ; \
GHC_RULE(realToFrac/T->a,realToFrac = \(T x) -> realToFrac x)

#define INSTANCE_READ(T,B) \
instance Read T where { \
Expand Down

0 comments on commit 1642418

Please sign in to comment.