Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- data Matter = Solid | Liquid | Gas
- interface MyEq ty where
- (==) : ty -> ty -> Bool
- (/=) : ty -> ty -> Bool
- MyEq Matter where
- (==) Solid Solid = True
- (==) Liquid Liquid = True
- (==) Gas Gas = True
- (==) _ _ = False
- (/=) x y = not (x == y)
- occurrences : MyEq ty => (item :ty) -> (values : List ty) -> Nat
- occurrences item [] = 0
- occurrences item (value :: values) = case value == item of
- False => occurrences item values
- True => 1 + occurrences item values
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement