ornicar / scalex

[abandoned] Hoogle-like documentation search engine, for scala
MIT License
90 stars 13 forks source link

search modulo type isomorphisms #21

Open polux opened 13 years ago

polux commented 13 years ago

It would be awesome if (a => b) => list[a] => list[b] would find map. Modulo instanciation (list[int] => (int => float) => list[float]) would be great too.

david-christiansen commented 13 years ago

I'm personally not a fan of type isomorphisms for search, as I think the Hoogle approach is much better. Isomorphisms are good in that they let you re-arrange arguments, but they're not as practical when Unit starts getting involved, and they can mask important differences in side effects. The Hoogle approach of creating an infinite type graph and finding a sort of "edit distance" with a variant of Dijkstra's algorithm is nicer, as it also finds cases when the user forgot an argument or had one too many.

polux commented 13 years ago

Ok, maybe not full isomorphisms then. What I meant is that I mostly miss argument permutations and instantiation (I've seen Brent's slide about hoogle's approach some time ago and that was indeed the kind of approach I was advocating.)

david-christiansen commented 13 years ago

We're in agreement then :-) The difficult thing is figuring out how to integrate subtyping and mixins into the Hoogle approach - it's not totally trivial, in my opinion!