@@ -3,13 +3,12 @@
33module Type.UnionFind
44 ( Point
55 , fresh
6− , repr
76 , union
87 , equivalent
98 , redundant
10− , descriptor
11− , setDescriptor
12− , modifyDescriptor
9+ , get
10+ , set
11+ , modify
1312 )
1413 where
1514
@@ -75,8 +74,8 @@ repr point@(Pt ref) =
7574 return point2
7675
7776
78−descriptor :: Point a -> IO a
79−descriptor point@(Pt ref) =
77+get :: Point a -> IO a
78+get point@(Pt ref) =
8079 do pInfo <- readIORef ref
8180 case pInfo of
8281 Info _ descRef ->
@@ -89,11 +88,11 @@ descriptor point@(Pt ref) =
8988 readIORef descRef
9089
9190 Link _ ->
92− descriptor =<< repr point
91+ get =<< repr point
9392
9493
95−setDescriptor :: Point a -> a -> IO ()
96−setDescriptor point@(Pt ref) newDesc =
94+set :: Point a -> a -> IO ()
95+set point@(Pt ref) newDesc =
9796 do pInfo <- readIORef ref
9897 case pInfo of
9998 Info _ descRef ->
@@ -107,11 +106,11 @@ setDescriptor point@(Pt ref) newDesc =
107106
108107 Link _ ->
109108 do newPoint <- repr point
110− setDescriptor newPoint newDesc
109+ set newPoint newDesc
111110
112111
113−modifyDescriptor :: Point a -> (a -> a) -> IO ()
114−modifyDescriptor point@(Pt ref) func =
112+modify :: Point a -> (a -> a) -> IO ()
113+modify point@(Pt ref) func =
115114 do pInfo <- readIORef ref
116115 case pInfo of
117116 Info _ descRef ->
@@ -125,7 +124,7 @@ modifyDescriptor point@(Pt ref) func =
125124
126125 Link _ ->
127126 do newPoint <- repr point
128− modifyDescriptor newPoint func
127+ modify newPoint func
129128
130129
131130union :: Point a -> Point a -> a -> IO ()