-
-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
function search #11
function search #11
Conversation
This is very exciting to see! I'm sorry that I've been slow to respond. I'm preparing to move to Europe and haven't had reliable internet access for the past few days. This should not be a problem from Wednesday. I'm not keen on the Is there a reason to favour the Searching by type-class constraints would be quite useful, I think. I'm imagining entering |
I've not had great success with hoogle so I wasn't really motivated to mimic it. I think this might have more to do with what hoogle is searching than how (eg I could not find readMaybe by searching for its exact signature in hoogle but found it via google.. maybe just too new for hoogle?). Also I'm sure it has quite a bit to do with my limited haskell knowledge/experience :p Is there a way to search hoogle for input type String and output type Int and limit it to things that actually return an Int? Thought it would be interesting to try something else but I guess everyone would probably prefer hoogle for sanctuary. |
I'd love to see this pull request revived after we merge #13. One option is to filter the table of contents itself. Consider this simplified table of contents:
Were we asked to search for every function with
There are really three issues to consider:
You've noted some real limitations of Hoogle, @kedashoe. I wonder, though, whether it's possible to have more control over the search results without abandoning the familiar Hindley–Milner notation. We could, for example, provide an Exact matches only checkbox:
We could split Exact matches only into Starts with and Ends with if desired:
This approach seems flexible. We could, for example, include an Accept similar types checkbox to allow a search for |
I will switch gears and go with HM for the search format. I'm sure we can come up with ways to extend it if we feel the need :) |
superseded by #23 |
A search box!
<
search input (<int
matches functions that take at least 1 int)>
search output (>bool
matches functions that return a bool)|
search input or ouput (|array
matches function that either take or return an array)etr
matches "Either")<string >maybe
matches functions that take at least 1 string and return a maybe)other notes..
scripts/generate-sig-data
- reads the sanctuary README and writessig-data.js
to be used bysearch.js
- does the searching/uigenerate-sig-data depends on HMP, which does not currently handle non-curried functions. This means quite a few sanctuary functions (
flip
etc) are not searchable yet. Since we are in javascript land, I think it is fair to have HMP handle non-curried functions, so I'll work on that.I used snabbdom for the ui. More specifically, an unmerged pull request. I think the PR will be merged at some point. Or we can use browserify or something. Not a big deal either way I don't think.
search.js is 100% imperative. I started out use
S
andR
and it was quite slow, of course this was the type checking ofS
which I did not immediately realize. Played around with things for a bit, I don't have the old code but I wrote down some numbers just for kicks.searching through 113 item array with a function built using
S.pipe
, with type checking: 6000+ msS.pipe
w/o type checking: 1-10 msR.pipe
: 0.5 msother other notes..
maybe int
. probably can just concat all text for a given argument and fuzzy search that for very good results-a->b
or something like that)Let me know what you guys think of it so far