[Haskell] Eternal Compatibility In Theory
Duncan Coutts
duncan.coutts at worc.ox.ac.uk
Mon May 2 16:10:37 EDT 2005
On Mon, 2005-05-02 at 15:57 -0400, robert dockins wrote:
> >>Is there a way to reliably and automatically check if two versions of
> >>a haskell module are interface compatible?
> >
> > No, because it would have to check whether the semantics of functions
> > is the same, even if they are written differently.
>
> Of course, we cannot expect the computer to examine the semantics. We
> must rely on people to know when semantics change.
>
> Suppose I want to ask the easier question "do these two text files
> implement haskell modules which are _type_ compatable?", how would I do
> it? Ie, I want the test to fail if I change the type of some function
> foo, or if I add a method to a class declaration etc.
You can extract this information from ghc's .hi files. You'd need to
filter and munge the info a bit but take a look at the output from
$ ghc --show-iface Blah.hi
It would be useful to have a tool that emits the 'signature' of a module
so you can compare between versions for API changes.
Duncan
More information about the Haskell
mailing list