git.iko.soy/type-level-sets
on master help sign in
Generalized an instance of Updatable
437855cJoshua Chia
src/Data/Type/Map.hs+6−2
@@ -100,8 +100,12 @@ instance {-# OVERLAPS #-} Updatable v t ((v ':-> s) ': m) ((v ':-> t) ': m) wher
100instance Updatable v t m n => Updatable v t ((w ':-> y) ': m) ((w ':-> y) ': n) where
100instance Updatable v t m n => Updatable v t ((w ':-> y) ': m) ((w ':-> y) ': n) where
101 update (Ext w y m) v x = Ext w y (update m v x)
101 update (Ext w y m) v x = Ext w y (update m v x)
102
102
103−instance Updatable v t '[] '[v ':-> t] where
103+-- instance Updatable v t '[] '[v ':-> t] where
104+-- update Empty v x = Ext v x Empty
105+
106+instance Updatable v t s ((v ':-> t) ': s) where
104− update Empty v x = Ext v x Empty
107+ update xs v x = Ext v x xs
108+
105
109
106{-| Predicate to check if in normalised map form -}
110{-| Predicate to check if in normalised map form -}
107type IsMap s = (s ~ Nub (Sort s))
111type IsMap s = (s ~ Nub (Sort s))