forked from GitHub/gf-core
Moved transfer libraries to transfer/lib
This commit is contained in:
@@ -1,10 +1,4 @@
|
|||||||
data Bool : Type where
|
|
||||||
True : Bool
|
|
||||||
False : Bool;
|
|
||||||
|
|
||||||
depif : (A:Type) -> (B:Type) -> (b:Bool) -> A -> B -> if Type b then A else B
|
depif : (A:Type) -> (B:Type) -> (b:Bool) -> A -> B -> if Type b then A else B
|
||||||
depif _ _ True x _ = x
|
depif _ _ True x _ = x
|
||||||
depif _ _ False _ y = y
|
depif _ _ False _ y = y
|
||||||
|
|
||||||
not : Bool -> Bool
|
|
||||||
not b = if b then False else True
|
|
||||||
@@ -14,6 +14,18 @@ id : (A:Type) -> A -> A
|
|||||||
id _ x = x
|
id _ x = x
|
||||||
|
|
||||||
|
|
||||||
|
--
|
||||||
|
-- The Bool type
|
||||||
|
--
|
||||||
|
|
||||||
|
data Bool : Type where
|
||||||
|
True : Bool
|
||||||
|
False : Bool
|
||||||
|
|
||||||
|
not : Bool -> Bool
|
||||||
|
not b = if b then False else True
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
--
|
--
|
||||||
-- The Add class
|
-- The Add class
|
||||||
@@ -82,6 +94,31 @@ prod_Integer = rec one = 1
|
|||||||
times = prim_mul_Int
|
times = prim_mul_Int
|
||||||
|
|
||||||
|
|
||||||
|
--
|
||||||
|
-- The Neg class
|
||||||
|
--
|
||||||
|
|
||||||
|
Neg : Type -> Type
|
||||||
|
Neg = sig negate : A -> A
|
||||||
|
|
||||||
|
negate : (A : Type) -> Neg A -> A -> A
|
||||||
|
negate _ d = d.neg
|
||||||
|
|
||||||
|
-- Operators:
|
||||||
|
|
||||||
|
{-
|
||||||
|
(-x) => negate ? ? x
|
||||||
|
-}
|
||||||
|
|
||||||
|
-- Instances:
|
||||||
|
|
||||||
|
neg_Integer : Neg Integer
|
||||||
|
neg_Integer = rec negate = prim_neg_Int
|
||||||
|
|
||||||
|
neg_Bool : Neg Bool
|
||||||
|
neg_Bool = rec negate = not
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
--
|
--
|
||||||
-- The Eq class
|
-- The Eq class
|
||||||
@@ -145,7 +182,7 @@ ge = ordOp (\o -> case o of { LT -> False; _ -> True })
|
|||||||
gt : (A : Type) -> Ord A -> A -> A -> Bool
|
gt : (A : Type) -> Ord A -> A -> A -> Bool
|
||||||
gt = ordOp (\o -> case o of { GT -> True; _ -> False })
|
gt = ordOp (\o -> case o of { GT -> True; _ -> False })
|
||||||
|
|
||||||
-- Operators
|
-- Operators:
|
||||||
|
|
||||||
{-
|
{-
|
||||||
(x < y) => (lt ? ? x y)
|
(x < y) => (lt ? ? x y)
|
||||||
@@ -154,7 +191,7 @@ gt = ordOp (\o -> case o of { GT -> True; _ -> False })
|
|||||||
(x > y) => (gt ? ? x y)
|
(x > y) => (gt ? ? x y)
|
||||||
-}
|
-}
|
||||||
|
|
||||||
-- Instances
|
-- Instances:
|
||||||
|
|
||||||
ord_Integer : Ord Integer
|
ord_Integer : Ord Integer
|
||||||
ord_Integer = rec eq = prim_eq_Int
|
ord_Integer = rec eq = prim_eq_Int
|
||||||
@@ -177,7 +214,7 @@ show : (A : Type) -> Show A -> A -> String
|
|||||||
show _ d = d.show
|
show _ d = d.show
|
||||||
|
|
||||||
|
|
||||||
-- Instances
|
-- Instances:
|
||||||
|
|
||||||
show_Integer : Show Integer
|
show_Integer : Show Integer
|
||||||
show_Integer = rec show = prim_show_Int
|
show_Integer = rec show = prim_show_Int
|
||||||
Reference in New Issue
Block a user