Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Check that packages declare language extensions accurately #363

Closed
bos opened this Issue · 2 comments

2 participants

@bos
Owner

(Imported from Trac #370, reported by guest on 2008-10-13)

We'd like to make it possible to ensure all code on hackage lists precisely the -X extensions it uses.

This kind of thing

-XEmptyDataDecls -XTypeSynonymInstances -XMultiParamTypeClasses -XFlexibleInstances -XRank2Types -XScopedTypeVariables -XDeriveDataTypeable

Now, these should be listed in both the .cabal file, and in individual modules that require the extensions. We can check this by loading the modules in ghci.

The end result: we'd be able to filter on extensions. Researchers would be able to see precisely which extensions are used, and in what packages.

A simple 'is this type correct' script:

#!/bin/sh
echo "Checking type correctness ... "
f=`mktemp`
for i in *.hs ; do
     ghci -cpp -Iinclude -v0 $i < /dev/null
done > $f 2>&1
if cmp -s $f /dev/null ; then
    echo "Passed"
    true
else
    echo "Failed"
    cat $f
    false
fi
@bos
Owner

(Imported comment by @dcoutts on 2008-10-13)

Closely related to this is the problem that the extensions field does not quite mean what we want. It currently means to apply those excetions to all the modules in the package, but what we want it to mean is that this package uses these extensions (and not all modules need use all the extensions).

I fear we need a different name for this meaning or we'll break lots of existing packages. We can gradually move to the new system.

Eg use

library
uses-extensions: Foo, Bar
This is a declaration to the outside world that this library uses these extensions, however it does not mean that we pass -XFoo -XBar when buliding this library. We expect the .hs files to use the LANGUAGE pragma. This uses-extensions field would just be the union of all the extensions listed in the LANGUAGE pragma.

The next question would be how to enforce that the declaration is accurate. We could parse the OPTIONS and LANGUAGE pragmas to extract the languages used.

Note also that we should be encouraging the use of the portable LANGUAGE pragma, not ghc's -X flags.

@tibbe
Owner

Closing as there's been no activity in years.

We're cleaning up the bug tracker to make it useful again and are thus closing bugs that haven't seen any activity in a long time. Please re-open (or file a new bug) if the problem reappears.

@tibbe tibbe closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.