[server] Add schema for tree-like node structures

This commit is contained in:
Joscha 2020-03-15 14:29:58 +00:00
parent cdfe515df6
commit f6a281fee1
3 changed files with 53 additions and 0 deletions

View file

@ -70,6 +70,12 @@ data OrderedMap k a = OrderedMap
instance (Ord k, Show k, Show a) => Show (OrderedMap k a) where
show m = "fromList " ++ show (toList m)
instance Functor (OrderedMap k) where
fmap = Forest.OrderedMap.map
instance (Ord k) => Foldable (OrderedMap k) where
foldMap f = foldMap f . elems
-- Invariants of this data type:
--
-- 1. The 'omOrder' list contains each key from 'omMap' exactly once.