Today we’re releasing the first version of Codesearch – an online search through all Haskell, Rust, and Ruby packages. With support for regular expressions!
You could just click on the link but you want a picture, so here it is
Perhaps you always wondered (probably not, but still): do Haskellers use those really obscure operators from
Well, if they do, at least they are sensible enough to not upload it to Hackage, the main Haskell package repository. There are more matches than the screenshot shows, but they are all either from
lens or reexports from
We’ve got more Haskell examples
Is there a JSON parser written in Megaparsec that I can steal for a task at work? Yes, but it’s in some obscure library and GPL-3 licensed, so I won’t bother.
What library should I use for basic auth? Searching for
"Basic "is enough – though not bulletproof – to find libraries that implement it.
Are there libraries that provide anonymous records with
FromJSONinstances? Yeah, or at least something close to that. Searching for
Which of my dependencies is throwing
read-loop: AsyncCancelled? Oh right, it’s the Cassandra bindings.
Does anybody reexport the evil
Show (a -> b)instance from
Text.Show.Functions? This one doesn’t work so well because we can’t yet exclude paths and so we get lots of
tests/modules, but it looks like avro does and it’s actively developed, so I filed an issue.
We also do Rust and Ruby
Examples pending! Please comment below if you find any interesting usecases. Same goes for Haskell, actually.
Our potassium is superior
A rundown of competing tools:
Google can’t search for special symbols, and Haskell uses those heavily.
Github search is just extremely moody. (And like Google, it also doesn’t support regexps.)
Sourcegraph is cool and does support regexps, but I haven’t found a way to actually grep through all Haskell packages – they only search through Github repositories and they require limiting the search scope (so, searching through all
.hsfiles on Github doesn’t work).
And we accept contributions
The project is written in Scala and lives on GitHub. It’s not hard to set up and the codebase is not big either. We’re an independent project sponsored by Monadfix, and so we can offer bounties and token salaries to outside contributors. Also, if you speak Russian, send me a DM to join our dev Slack!
Finally, here’s what the future holds
We collect possible usecases and we plan to eventually support all of them. This is more-or-less a matter of adding more filters and doing source preprocessing (e.g. you should be able to filter out matches in comments).
Another interesting thing is “match statistics” – e.g. how many packages use a certain language feature or import a certain module? How many will break once a new compiler extension steals a piece of syntax? Are those packages widely used, or not really? That’s the kind of questions that authors of compilers, language tools, and popular libraries should be able to easily get answers to.
And of course, we need to cover more languages! That’s where contributions would be especially helpful. Wink, nudge.