@@ -3,13 +3,12 @@
3module Type.UnionFind
3module Type.UnionFind
8 , equivalent
7 , equivalent
9 , redundant
8 , redundant
11− , setDescriptor
10+ , set
12− , modifyDescriptor
11+ , modify
@@ -75,8 +74,8 @@ repr point@(Pt ref) =
75 return point2
74 return point2
78−descriptor :: Point a -> IO a
77+get :: Point a -> IO a
79−descriptor point@(Pt ref) =
78+get point@(Pt ref) =
80 do pInfo <- readIORef ref
79 do pInfo <- readIORef ref
81 case pInfo of
80 case pInfo of
82 Info _ descRef ->
81 Info _ descRef ->
@@ -89,11 +88,11 @@ descriptor point@(Pt ref) =
89 readIORef descRef
88 readIORef descRef
92− descriptor =<< repr point
91+ get =<< repr point
95−setDescriptor :: Point a -> a -> IO ()
94+set :: Point a -> a -> IO ()
96−setDescriptor point@(Pt ref) newDesc =
95+set point@(Pt ref) newDesc =
97 do pInfo <- readIORef ref
96 do pInfo <- readIORef ref
98 case pInfo of
97 case pInfo of
99 Info _ descRef ->
98 Info _ descRef ->
@@ -107,11 +106,11 @@ setDescriptor point@(Pt ref) newDesc =
108 Link _ ->
107 Link _ ->
109 do newPoint <- repr point
108 do newPoint <- repr point
110− setDescriptor newPoint newDesc
109+ set newPoint newDesc
113−modifyDescriptor :: Point a -> (a -> a) -> IO ()
112+modify :: Point a -> (a -> a) -> IO ()
114−modifyDescriptor point@(Pt ref) func =
113+modify point@(Pt ref) func =
115 do pInfo <- readIORef ref
114 do pInfo <- readIORef ref
116 case pInfo of
115 case pInfo of
117 Info _ descRef ->
116 Info _ descRef ->
@@ -125,7 +124,7 @@ modifyDescriptor point@(Pt ref) func =
126 Link _ ->
125 Link _ ->
127 do newPoint <- repr point
126 do newPoint <- repr point
128− modifyDescriptor newPoint func
127+ modify newPoint func
131union :: Point a -> Point a -> a -> IO ()
130union :: Point a -> Point a -> a -> IO ()