28 lines
423 B
Plaintext
28 lines
423 B
Plaintext
module Data.Object
|
|
|
|
import Data.Bool;
|
|
|
|
export eq(x :: a, y :: a) :: Bool = prim%eq(x,y);
|
|
|
|
class Eq a {
|
|
(==)(x :: a, y :: a) :: Bool = not (x /= y);
|
|
(/=)(x :: a, y :: a) :: Bool = not (x == y);
|
|
}
|
|
|
|
instance Eq () {
|
|
(==)(x,y) = True;
|
|
(/=)(x,y) = False;
|
|
}
|
|
|
|
instance Eq Bool {
|
|
(/=)(x,y) = x ^ y;
|
|
}
|
|
|
|
class SafelyConvertable a b {
|
|
safeConvert :: a -> b;
|
|
}
|
|
|
|
class UnsafelyConvertable a b {
|
|
unsafeConvert :: a -> b;
|
|
}
|