-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmapSetGraphrefactor
More file actions
25 lines (19 loc) · 983 Bytes
/
Copy pathmapSetGraphrefactor
File metadata and controls
25 lines (19 loc) · 983 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
size balanced b tree / avl
code should be in one place.
in ghc 6.8.3, try gre -irl avl
Data.Graph.Inductive.Tree should use Data.Map, or perhaps should use something that Data.Map is also using.
Should then be easy to get serializeable instance for Gr.
In HAppS.Data.Serialize there is already
-- note below, Data.Map doesn't export constructors.
instance Version (Map.Map a b) where mode = Primitive
instance (Serialize a,Serialize b, Eq a) => Serialize (Map.Map a b) where
getCopy = contain ( fmap Map.fromAscList safeGet )
putCopy m = contain . safePut . Map.toList $ m
We could then add
-- note, Gr does export constructor Gr
instance Version (Gr a b) where mode = Primitive
instance (Serialize a,Serialize b, Eq a) => Serialize (Map.Map a b) where
getCopy = contain ( fmap ( Gr . Map.fromAscList )safeGet )
putCopy (Gr m) = contain . safePut . Map.toList $ m
??? no...
For now though the quicker fix is to simply add fromAscList to graph FiniteMap.