Quite a few more bang files for testing.
This commit is contained in:
27
bsrc/Data/Object.bs
Normal file
27
bsrc/Data/Object.bs
Normal file
@@ -0,0 +1,27 @@
|
||||
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;
|
||||
}
|
||||
Reference in New Issue
Block a user