Advertisement
Guest User

Untitled

a guest
Jul 16th, 2018
92
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.66 KB | None | 0 0
  1. public export
  2. data Uni : a -> UniqueType where
  3. U : a -> Uni a
  4.  
  5. export
  6. data UComparator : Nat -> a -> UniqueType where
  7. MkComparator : (allowedUses : Nat) -> (comp : (a -> a -> Bool)) -> UComparator allowedUses a
  8.  
  9. interface EfficientLookup (c : UniqueType) where
  10. keyType : c -> Type
  11. valType : c -> Type
  12. size : c -> Nat
  13. lookupImpl : (coll : c) -> (UComparator (size coll) (keyType coll)) -> (keyType coll) -> Uni (valType coll)
  14.  
  15. export
  16. total compareOnce : {n : Nat} -> {a : Type} -> UComparator (S n) a -> a -> a -> UPair Bool (UComparator n a)
  17. compareOnce (MkComparator (S rem) comp) a1 a2 = (comp a1 a2, MkComparator rem comp)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement