Overlapping, undecidable, incoherent -- or worse?
MR K P SCHUPKE
k.schupke at imperial.ac.uk
Thu May 20 14:42:57 EDT 2004
| > class PO a where
| > (|=3D) :: a -> a -> Bool
| >
| > class Num a =3D> SemiRing a
| >
| > class SemiRing a =3D> CSemiRing a
| >
| > instance (Bounded a, Enum a, SemiRing a) =3D> PO a where
| > a |=3D b
| > =3D or [ a + c =3D=3D b | c <- boundedEnumFrom minBound ]
| >
| > instance CSemiRing a =3D> PO a where
| > a |=3D b =3D a + b =3D=3D b
Perhaps this means that SemiRing and CSemiRing should be types:
class PO a where
(|=) :: a -> a -> Bool
data Num a => SemiRing a = SemiRing a
data Num a => CSemiRing a = CSemiRing a
instance (Bounded a,Enum a) => PO (SemiRing a) where
(SemiRing a) |= (SemiRing b) = SemiRing ( or [ a + c == b | c <- boundedEnumFrom minBound ] )
instance PO (CSemiRing a) where
(CSemiRing a) |= (CSemiRing b) = CSemiRing ( a + b == b )
Regards,
Keean
More information about the Glasgow-haskell-users
mailing list