Open hackeryarn opened 8 years ago
This would be very nice indeed!
agree 100% that would be nice.
I agree. This would be very nice. I don't have a clue as to how to implement it, but I want it. I was talking about this just the other day.
If it were just text search, I think it would be easy enough, but it should be smart enough not to distinguish between (a -> b) -> [a] -> [b]
and (c -> d) -> [c] -> [d]
, yet still recognize that while this is related, it's more specific: (x -> x) -> [x] -> [x]
.
Anyone have ideas?
My only idea on this would be some tricky pattern matching or regexs.
Such as just checking that structure and ignoring the value names.
couldn't we replace the current search/filtering with a nice js fuzzy search library?
do you have one in mind?
The ones ive played around with:
http://glench.github.io/fuzzyset.js/ http://kiro.me/projects/fuse.html
I'm on the lookout for one for a work project too, although I haven't started actually looking yet. (I'm actually much more interested in solving that problem myself. It would be nice to do something algorithmically interesting for a change.)
@CrossEye gotcha, maybe we can add something temporary and then switch it to something you've created... whatever works :smile:
Ok, off to research the Bitap algorithm. Looks like fun.
No, there's plenty of fun in Ramda; it's the day job that needs some sprucing up. It's also in a company with a long drawn-out approval process for third-party tools (not that we always tell them, but as this would be consumer-facing it might take some doing.) If I built my own there, there's no approval needed.
I'm all for trying to find a good tool for Ramda to use.
The trouble is that I think what we most want is a lot more tagging in order to search. It's not so much the fuzzy search, but the missing metadata. But I could be mistaken.
The trouble is that I think what we most want is a lot more tagging in order to search.
In agreement here - more tags to group searches by would be excellent, and cater to a wider audience. However, fuzzy search on type signatures would definitely be a helpful addition too.
makes sense, its probably just missing the signature in the filter code, i was just messing around with the libraries i mentioned above feeding them a data structure like which i scrapped from the DOM
...
{
"signature": "(a → a) → Number → [a] → [a]",
"name": "adjust",
"category": "List"
},
{
"signature": "(a → Boolean) → [a] → Boolean",
"name": "all",
"category": "List"
},
{
"signature": "[(*… → Boolean)] → (*… → Boolean)",
"name": "allPass",
"category": "Logic"
},
{
"signature": "[a] → Boolean",
"name": "allUniq",
"category": "List"
},
{
"signature": "a → (* → a)",
"name": "always",
"category": "Function"
}
...
worked pretty well...
The problem is that a good fuzzy type search seems much more sophisticated than a fuzzy text search. If we search Hoogle for (a -> b -> c) -> a -> [b] -> c
, the results include for instance,
foldl :: (a -> b -> a) -> a -> [b] -> a
zipWith :: (a -> b -> c) -> [a] -> [b] -> [c]
but do not include
map :: (a -> b) -> [a] -> [b]
I'm not sure if text searches would be able to do that well.
i was just messing around with the libraries i mentioned above feeding them a data structure like which i scrapped from the DOM
... { "signature": "(a → a) → Number → [a] → [a]", "name": "adjust", "category": "List" },
Funny, I was playing around with something similar thinking about #1652, also scraped from the DOM, although I would hope to do it differently someday. Mine was an object grouped by category, and signature
was a list. (See, for instance, init
, last
, nth
.) But it's still much the same idea.
I really like my new Alfred workflow for Ramda docs, which has baked in support for type signatures :smile: Here is an example usage off my desktop:
I just choose the function I am looking for (in this example by type signature) and it takes me off to the required definition on ramdajs.
Thanks to raine for taking the effort to set this up. Think I even prefer it to the bash support.
I've tried to implement some type driven search on http://ramda-search.now.sh It parses the signature to make some more educated search, but right now it doesn't yet implement the extended logic of https://github.com/ramda/ramda.github.io/issues/61#issuecomment-187207603
@dawehner:
This looks like a very promising start. Is the code available somewhere?
This week I will open a pull request for sanctuary-search, which will support type variable substitution as well as less fancy Hoogle features. The module will be used on the Sanctuary website; it may be a good fit for the Ramda website too.
@CrossEye Thank you.I've implemented it here: https://github.com/dawehner/elm-ramda-search/blob/master/src/Main.elm it is in elm, feel free to ask questions if you want to know about it.
@davidchambers Interesting, I've never heard of sanctuary before, sorry :| I like the existence of Nothing for example! Looking forward to see how you implement the search.
Would it be possible to incorporate type signature search in the current search bar. Something resembling Hoogle like functionality.
I would really like to be able to search for
(a → b) → f a → f b
and get map.