[Haskell-cafe] Haskell statistics for use of TypeFamilies and FunctionalDependencies
Gwern Branwen
gwern0 at gmail.com
Thu May 5 23:54:59 CEST 2011
Continuing my investigation of my local copies of
patch-tag+github+c.h.o+misc repositories (, I rewrote my
haskell-src-exts script to examine LANGUAGE extensions in use
(ignoring any .cabal flags):
import Language.Haskell.Exts
import qualified Data.Foldable as F (concat)
import Control.Monad (when)
main :: IO ()
main = do args <- fmap lines $ getContents
mapM_ (\a -> checkAndPrint a `catch` (\_ -> return ())) args
checkAndPrint :: FilePath -> IO ()
checkAndPrint fs = do x <- readFile fs
let exts = F.concat $ readExtensions x
let exts' = filter (\y -> y ==
FunctionalDependencies || y == TypeFamilies) exts
when (not $ null exts') $ putStr (fs++":") >>
(putStrLn $ unwords $ map show exts)
return ()
The attachment is the gzipped* result of `find . -type f -name "*?hs"
| sort | runhaskell ~/extensions.hs >> ~/exts.txt`.
Notes:
- 3597 files matched either LANUAGE
- there were:
2685 users of TypeFamilies
1030 users of FunctionalDependencies
118 users of TypeFamilies+FunctionalDependencies
2.7k TypeFamilies may be surprisingly large; if so, it may be due to
GHC and its duplicates; 947 lines match the string 'ghc' and 721
lines match both 'ghc' and 'TypeFamilies'.
* 500k is a bit much for an attachment
--
gwern
http://www.gwern.net
-------------- next part --------------
A non-text attachment was scrubbed...
Name: foo.gz
Type: application/x-gzip
Size: 48782 bytes
Desc: not available
URL: <http://www.haskell.org/pipermail/haskell-cafe/attachments/20110505/7c16362a/attachment.bin>
More information about the Haskell-Cafe
mailing list