This post was inspired by a curious
question on
Twitter: is curry
or uncurry
more common in Haskell code?
To answer this, we first use Jacinda to download every package on Hackage, viz.
cabal list --simple | ja '~.$1' | xargs cabal get
This will gives us a large sample with many authors.
To find uses of uncurry
, we use ripgrep with the
following incantation:
rg '[ \(\)]uncurry[ \(\)]' hackage/ --stats
This doesn't actually find every instance of uncurry
on Hackage, but it's good
enough for our purposes.
Uncurry
rg '[ \(\)]uncurry[ \(\)]' hackage/ --stats
...
7966 matched lines
4346 files contained matches
289306 files searched
2.879 seconds
Curry
rg '[ \(\)]curry[ \(\)]' hackage/ --stats
...
1154 matched lines
525 files contained matches
289306 files searched
2.572 seconds
As we can see, uncurry
is nearly eight times more common than curry
! I have
no explanation for why this is the case, but I think it's quite an interesting
result.