sinelaw / infernu

Type inference and checking for a safer JavaScript.
GNU General Public License v2.0
338 stars 11 forks source link

Consider using a better equivalence classes implementation #3

Closed sinelaw closed 9 years ago

sinelaw commented 9 years ago

Currently InferState has: varInstances :: Map.Map TVarName (Set.Set QualType) It may be faster to use an int-based equivalence class implementation (maybe the package disjoint-set?) The problem is that the current implementation supports arbitrary types (for when a type variable in the equivalence has been substituted with a non-tvar type), and with an Int-based equivalence we'll need to add another layer of indirection.

sinelaw commented 9 years ago

No longer an issue - changed to use a graph (tree actually) rather than equivalence classes due to some correctness issues. Incidentally the fgl graphs use Patricia Trees (IntMap) internally so performance should be good too.