Skip to content

Commit a8fee68

Browse files
committed
Initial commit
0 parents  commit a8fee68

File tree

6 files changed

+750
-0
lines changed

6 files changed

+750
-0
lines changed

Diff for: .gitignore

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
.cabal-sandbox/
2+
cabal.sandbox.config
3+
dist/

Diff for: Main.hs

+553
Large diffs are not rendered by default.

Diff for: README.md

+121
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,121 @@
1+
# hackage-diff
2+
3+
Compare the public API of different versions of a Hackage library.
4+
5+
Sample output for `hackage-diff mtl 2.0.1.1 2.2.1`:
6+
7+
```
8+
Downloading Hoogle DBs...
9+
Parsing Hoogle DBs...
10+
Comparing Hoogle DBs...
11+
12+
--- Diff for | 2.0.1.1 → 2.2.1 | ---
13+
14+
+ Control.Monad.Except
15+
+ type Except e = ExceptT e Identity
16+
+ newtype ExceptT e (m :: * -> *) a :: * -> (* -> *) -> * -> *
17+
+ ExceptT :: m (Either e a) -> ExceptT e a
18+
+ class Monad m => MonadError e m | m -> e
19+
+ catchError :: MonadError e m => m a -> (e -> m a) -> m a
20+
+ mapExcept :: (Either e a -> Either e' b) -> Except e a -> Except e' b
21+
+ mapExceptT :: (m (Either e a) -> n (Either e' b)) -> ExceptT e m a -> ExceptT e' n b
22+
+ runExcept :: Except e a -> Either e a
23+
+ runExceptT :: ExceptT e m a -> m (Either e a)
24+
+ throwError :: MonadError e m => e -> m a
25+
+ withExcept :: (e -> e') -> Except e a -> Except e' a
26+
+ withExceptT :: Functor m => (e -> e') -> ExceptT e m a -> ExceptT e' m a
27+
× Control.Monad.Cont
28+
× Control.Monad.Cont.Class
29+
+ instance MonadCont m => MonadCont (ExceptT e m)
30+
× Control.Monad.Error
31+
× Control.Monad.Error.Class
32+
+ instance Monad m => MonadError e (ExceptT e m)
33+
+ instance MonadError e (Either e)
34+
- instance Error e => MonadError e (Either e)
35+
× Control.Monad.RWS.Class
36+
+ instance MonadRWS r w s m => MonadRWS r w s (ExceptT e m)
37+
× Control.Monad.RWS.Lazy
38+
× Control.Monad.RWS.Strict
39+
× Control.Monad.Reader
40+
× New: reader :: MonadReader r m => (r -> a) -> m a
41+
Old: reader :: (r -> a) -> Reader r a
42+
× Control.Monad.Reader.Class
43+
+ instance MonadReader r m => MonadReader r (ExceptT e m)
44+
+ reader :: MonadReader r m => (r -> a) -> m a
45+
× Control.Monad.State.Class
46+
+ instance MonadState s m => MonadState s (ExceptT e m)
47+
+ modify' :: MonadState s m => (s -> s) -> m ()
48+
+ state :: MonadState s m => (s -> (a, s)) -> m a
49+
× Control.Monad.State.Lazy
50+
+ modify' :: MonadState s m => (s -> s) -> m ()
51+
× New: state :: MonadState s m => (s -> (a, s)) -> m a
52+
Old: state :: (s -> (a, s)) -> State s a
53+
× Control.Monad.State.Strict
54+
+ modify' :: MonadState s m => (s -> s) -> m ()
55+
× New: state :: MonadState s m => (s -> (a, s)) -> m a
56+
Old: state :: (s -> (a, s)) -> State s a
57+
× Control.Monad.Writer.Class
58+
+ instance MonadWriter w m => MonadWriter w (ExceptT e m)
59+
+ writer :: MonadWriter w m => (a, w) -> m a
60+
× Control.Monad.Writer.Lazy
61+
× New: writer :: MonadWriter w m => (a, w) -> m a
62+
Old: writer :: (a, w) -> Writer w a
63+
× Control.Monad.Writer.Strict
64+
× New: writer :: MonadWriter w m => (a, w) -> m a
65+
Old: writer :: (a, w) -> Writer w a
66+
· Control.Monad.Identity
67+
· Control.Monad.List
68+
· Control.Monad.RWS
69+
· Control.Monad.State
70+
· Control.Monad.Trans
71+
· Control.Monad.Writer
72+
73+
[+ Added] [- Removed] [× Modified] [· Unmodified]
74+
```
75+
76+
In the terminal it can also use ANSI colors.
77+
78+
# Usage
79+
80+
```
81+
hackage-diff | Compare the public API of different versions of a Hackage package
82+
github.com/blitzcode/hackage-diff | www.blitzcode.net | (C) 2014 Tim C. Schroeder
83+
84+
Usage: hackage-diff [options] <package-name> <old-version> <new-version>
85+
--mode=[downloaddb|builddb|parsehs] what to download, how to compare
86+
downloaddb - download Hoogle DBs and diff (Default)
87+
builddb - download packages, build Hoogle DBs and diff
88+
parsehs - download packages, directly diff .hs exports
89+
-c --disable-color disable color output
90+
-s --silent disable progress output
91+
```
92+
93+
For instance, `hackage-diff base 4.6.0.0 4.7.0.0` compares the last two major releases of `base`.
94+
95+
# Modes
96+
97+
`hackage-diff` can operate in there different modes which determine how it obtains and parses the information about the packages to be compared.
98+
99+
### downloaddb
100+
101+
Download the Hoogle databases for both packages from Hackage, then parse and diff them. This is the default and recommended mode of operation. Sometimes Hackage does not have a Hoogle database for a particular version available. In this case, running with `builddb` might be more successful.
102+
103+
### builddb
104+
105+
Download the package sources from Hackage, setup sandboxes, install dependencies, configure and use Haddock to build the Hoogle databases, parse and diff them. This is often very time consuming due to the dependency installation required for the Haddock build. Sometimes Haddock builds will fail, especially for older packages.
106+
107+
### parsehs
108+
109+
Download the package sources from Hackage, parse `.cabal` file for exported modules, pre-process them with `cpphs`, parse them with `haskel-src-exts` and diff their export lists. This mode has many downsides. Packages making heavy use of the CPP will often fail to be parsed as the pre-processing done here is not identical to what a Cabal build would do. `haskel-src-exts` sometimes fails to parse code that GHC would accept. We only look at the export lists, so modules without an explicit one will fail to be parsed correctly. There's no inspection of the types of exports, only names will be compared.
110+
111+
# TODO
112+
113+
This tools has various shortcomings and limitations and has only received a small amount of testing. Please let me know if you find an issue. Also see the various `TODO` comments scattered throughout the code.
114+
115+
# Legal
116+
117+
This program is published under the [MIT License](http://en.wikipedia.org/wiki/MIT_License).
118+
119+
# Author
120+
121+
Developed by Tim C. Schroeder, visit my [website](http://www.blitzcode.net) to learn more.

Diff for: Setup.hs

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
import Distribution.Simple
2+
main = defaultMain

Diff for: cabal.config

+33
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
constraints: Cabal ==1.20.0.1,
2+
HTTP ==4000.2.17,
3+
ansi-terminal ==0.6.1.1,
4+
array ==0.5.0.0,
5+
async ==2.0.1.5,
6+
attoparsec ==0.12.1.0,
7+
base ==4.7.0.1,
8+
bytestring ==0.10.4.0,
9+
containers ==0.5.5.1,
10+
cpphs ==1.18.5,
11+
deepseq ==1.3.0.2,
12+
directory ==1.2.1.0,
13+
filepath ==1.3.0.2,
14+
ghc-prim ==0.3.1.0,
15+
hackage-diff ==0.1.0.0,
16+
hashable ==1.2.2.0,
17+
haskell-src-exts ==1.15.0.1,
18+
integer-gmp ==0.5.1.0,
19+
mtl ==2.2.1,
20+
network ==2.5.0.0,
21+
old-locale ==1.0.0.6,
22+
old-time ==1.1.0.2,
23+
parsec ==3.1.5,
24+
polyparse ==1.9,
25+
pretty ==1.1.1.1,
26+
process ==1.2.0.0,
27+
rts ==1.0,
28+
scientific ==0.3.3.0,
29+
stm ==2.4.3,
30+
text ==1.1.1.3,
31+
time ==1.4.2,
32+
transformers ==0.4.1.0,
33+
unix ==2.7.0.1

Diff for: hackage-diff.cabal

+38
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
-- Initial hackage-diff.cabal generated by cabal init. For further
2+
-- documentation, see http://haskell.org/cabal/users-guide/
3+
4+
name: hackage-diff
5+
version: 0.1.0.0
6+
synopsis: Compare the public API of different versions of a Hackage library
7+
-- description:
8+
license: MIT
9+
-- license-file: LICENSE
10+
author: Tim C. Schroeder
11+
maintainer: www.blitzcode.net
12+
-- copyright:
13+
category: Distribution
14+
build-type: Simple
15+
-- extra-source-files:
16+
cabal-version: >=1.10
17+
18+
executable hackage-diff
19+
main-is: Main.hs
20+
-- other-modules:
21+
-- other-extensions:
22+
build-depends: base >=4.7 && <4.8,
23+
Cabal >=1.20.0.1,
24+
haskell-src-exts,
25+
ansi-terminal,
26+
directory,
27+
filepath,
28+
process,
29+
attoparsec,
30+
cpphs,
31+
mtl,
32+
text,
33+
HTTP,
34+
async
35+
-- hs-source-dirs:
36+
default-language: Haskell2010
37+
ghc-options: -Wall -O2 -rtsopts
38+
ghc-prof-options: -fprof-auto -caf-all

0 commit comments

Comments
 (0)