make IsQty interface
This commit is contained in:
parent
b47ef502f3
commit
b29b7855a2
1 changed files with 25 additions and 12 deletions
|
@ -35,20 +35,33 @@ prettyQtyBinds =
|
||||||
|
|
||||||
|
|
||||||
public export
|
public export
|
||||||
(+) : Qty -> Qty -> Qty
|
plus : Qty -> Qty -> Qty
|
||||||
Zero + rh = rh
|
plus Zero rh = rh
|
||||||
pi + Zero = pi
|
plus pi Zero = pi
|
||||||
_ + _ = Any
|
plus _ _ = Any
|
||||||
|
|
||||||
public export
|
public export
|
||||||
(*) : Qty -> Qty -> Qty
|
times : Qty -> Qty -> Qty
|
||||||
Zero * _ = Zero
|
times Zero _ = Zero
|
||||||
_ * Zero = Zero
|
times _ Zero = Zero
|
||||||
One * rh = rh
|
times One rh = rh
|
||||||
pi * One = pi
|
times pi One = pi
|
||||||
Any * Any = Any
|
times Any Any = Any
|
||||||
|
|
||||||
infix 6 <=.
|
infix 6 <=.
|
||||||
public export
|
public export
|
||||||
(<=.) : Qty -> Qty -> Bool
|
compat : Qty -> Qty -> Bool
|
||||||
pi <=. rh = rh == Any || pi == rh
|
compat pi rh = rh == Any || pi == rh
|
||||||
|
|
||||||
|
|
||||||
|
public export
|
||||||
|
interface IsQty q where
|
||||||
|
zero, one : q
|
||||||
|
(+), (*) : q -> q -> q
|
||||||
|
(<=.) : q -> q -> Bool
|
||||||
|
|
||||||
|
public export
|
||||||
|
IsQty Qty where
|
||||||
|
zero = Zero; one = One
|
||||||
|
(+) = plus; (*) = times
|
||||||
|
(<=.) = compat
|
||||||
|
|
Loading…
Reference in a new issue