diff --git a/CHANGELOG.md b/CHANGELOG.md index 37c6e56..9096000 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,17 @@ Changes ======= +Version 0.6.0 +------------- + +* Use haskell-src-exts 1.17 +* Remove dependency on haskell-packages + +Version 0.5.3 +------------ + +* Compatibility with GHC 7.8.4 + Version 0.5.2 ------------- diff --git a/README.md b/README.md index 372dfb7..1094dd8 100644 --- a/README.md +++ b/README.md @@ -1,40 +1,32 @@ -haskell-names +haskell-names [![Build Status](https://travis-ci.org/phischu/haskell-names.svg?branch=master)](https://travis-ci.org/phischu/haskell-names) ============= haskell-names does name and module resolution for haskell-src-exts AST. Namely, it can do the following: -* for a module, compute its interface, i.e. the set of entities exported by the - module, together with their original names. -* for each name in the module, figure out what it refers to — whether it's bound +* for a liat of modules, compute the lists of symbols they export. + This is called `resolve`. +* for each name in a module, figure out what it refers to — whether it's bound locally (say, by a `where` clause) or globally (and then give its origin). + This is called `annotate`. Installation ------------ -To install a released version: - -1. Install Cabal and cabal-install from [the git repository][cabal] (the - `master` branch) -2. `cabal install haskell-names hs-gen-iface` - If you're building a development version, then you might also need to install -development versions of [haskell-src-exts][hse], [haskell-packages][hp], and [hse-cpp][]. +a development version of [haskell-src-exts][hse]. -[cabal]: https://github.com/haskell/cabal/ [hse]: https://github.com/haskell-suite/haskell-src-exts -[hp]: https://github.com/haskell-suite/haskell-packages -[hse-cpp]: https://github.com/haskell-suite/hse-cpp -Module interfaces ------------------ -`hs-gen-iface` is a «compiler» that generates interfaces for Haskell modules. +Environments +----------------- -An interface is a JSON file that lists all entities (types, classes, functions -etc.) exported by every module. For example, here are a couple of entries from -`Prelude.names`: +An environment is a map from module name to list of entities the module exports. +Entities are for example types, class, functions etc. We store these lists in +a JSON format. +For example, here are a couple of entries from `Prelude.names`: ``` json [ @@ -56,65 +48,13 @@ As you see, each entity is annotated with the module where it was originally defined. Additionally, class methods, field selectors, and data constructors are annotated with the class or type they belong to. -### Generating interfaces - -Thanks to haskell-packages, `hs-gen-iface` is fully integrated with Cabal. To -produce and install interface files, pass `--haskell-suite -w hs-gen-iface` flags -to `cabal install`, for instance - - cabal install --haskell-suite -w hs-gen-iface mtl - -This assumes that the `hs-gen-iface` executable is in your `PATH`. You can specify -the full path to `hs-gen-iface` after `-w`, too. - -#### Core packages - -haskell-names comes with the global package database populated with some core -packages: - - % hs-gen-iface pkg list --global - array-0.4.0.2 - base-4.7.0.0 - integer-simple-0.1.1.0 - ghc-prim-0.3.1.0 - -#### Compiling core packages by hand - -Suppose you need to compile any of the core packages by hand — for example, to -get a different version than the one bundled with haskell-names. - -Core packages, such as `ghc-prim`, `integer-simple`, `array`, and `base`, are -highly GHC-specific and need to be tweaked a bit before they can be processed by -haskell-names. Get our modified versions: - -* [ghc-prim](https://github.com/haskell-suite/ghc-prim) -* [array](https://github.com/haskell-suite/array) -* [base](https://github.com/haskell-suite/base) -* [integer-simple](https://github.com/haskell-suite/integer-simple) - -Note that Cabal's new dependency solver won't let you install `ghc-prim` -or `base` easily. There are two ways to work around this: - -1. Use the old solver: - - cabal install --haskell-suite -w hs-gen-iface --solver=topdown - -2. Invoke all the steps manually: - - cabal configure --haskell-suite -w hs-gen-iface - cabal build - cabal install --only - -### Using interfaces - -You can parse interface files directly, but a better idea is to use -`Distribution.HaskellSuite.Packages` API (from haskell-packages), combined with -the package database `NamesDB` defined in `Language.Haskell.Modules.Interfaces`. +`haskell-names` provides functions `readSymbols` and `writeSymbols` +to read and write interface files. Name resolution --------------- -The `annotateModule` function annotates the module with scoping information. +The `annotate` function annotates the given module with scoping information. Its essence is described in the article [Open your name resolution][openrec]. @@ -128,20 +68,26 @@ Let's say you have a module and you want to find out whether it uses ``` haskell module Main where -import Language.Haskell.Exts.Annotated -import qualified Language.Haskell.Exts as UnAnn (Name(Ident)) -import Language.Haskell.Names -import Language.Haskell.Names.Interfaces -import Distribution.HaskellSuite -import Distribution.Simple.Compiler - -import Data.Maybe -import Data.List -import Data.Proxy -import qualified Data.Foldable as Foldable -import Text.Printf -import Control.Applicative -import Control.Monad +import Language.Haskell.Exts.Annotated ( + fromParseResult, parseModuleWithMode, defaultParseMode, + parseFilename, prettyPrint, srcInfoSpan) +import Language.Haskell.Exts ( + Name(Ident), ModuleName(ModuleName)) +import Language.Haskell.Names ( + loadBase, annotate, symbolName, + Scoped(Scoped), NameInfo(GlobalSymbol)) + +import qualified Data.Map as Map ( + lookup) + +import Data.Maybe ( + fromMaybe, listToMaybe) +import Data.List ( + nub) +import qualified Data.Foldable as Foldable ( + toList) +import Control.Monad ( + forM_, guard) main :: IO () main = do @@ -149,64 +95,41 @@ main = do -- read the program's source from stdin source <- getContents - let - -- parse the program (using haskell-src-exts) - ast = fromParseResult $ - parseModuleWithMode defaultParseMode {parseFilename="stdin"} source - - -- get all installed packages (user and global) - pkgs <- - (++) <$> - getInstalledPackages (Proxy :: Proxy NamesDB) UserPackageDB <*> - getInstalledPackages (Proxy :: Proxy NamesDB) GlobalPackageDB - - headUsages <- evalNamesModuleT (findHeads ast) pkgs - - forM_ headUsages $ \loc -> - printf "Prelude.head is used at %s\n" (prettyPrint $ srcInfoSpan loc) - - when (null headUsages) $ - printf "Congratulations! Your code doesn't use Prelude.head\n" - --- | The `findHeads` function finds all occurrences of the `head` symbol in --- a given AST of a Haskell module. It needs access to stored name information --- and therefore runs in `ModuleT`. - findHeads :: Module SrcSpanInfo -> ModuleT [Symbol] IO [SrcSpanInfo] - findHeads ast = do - --- First we get all symbols exported from `Prelude` with `getModuleInfo`. - symbols <- fromMaybe (error "Prelude not found") <$> - getModuleInfo "Prelude" - --- Then we filter those for the one with name `"head"`. - let - headSymbol = - fromMaybe (error "Prelude.head not found") (listToMaybe (do - symbol <- symbols - guard (symbolName symbol == UnAnn.Ident "head") - return symbol)) - --- We annotate the given ast. - annotatedAst <- - annotateModule - Haskell2010 -- base language - [] -- set of extensions - ast - --- We get a list of all annotations from the annotated module. - let - annotations = Foldable.toList annotatedAst - --- A `GlobalSymbol` annotation means that the annotated name refers to a --- global symbol. It also contains the qualified name that corresponds --- to how it is referenced but that is not needed here. - headUsages = nub (do - Scoped (GlobalSymbol globalSymbol _) location <- annotations - guard (globalSymbol == headSymbol) - return location) - --- And finally we return all found usages. - return headUsages + -- parse the program (using haskell-src-exts) + let ast = fromParseResult ( + parseModuleWithMode defaultParseMode {parseFilename="stdin"} source) + + -- get base environment + baseEnvironment <- loadBase + + -- get symbols defined in prelude + let preludeSymbols = fromMaybe (error "Prelude not found") ( + Map.lookup (ModuleName "Prelude") baseEnvironment) + + -- find a Prelude symbol with name 'head' using the List monad + let headSymbol = fromMaybe (error "Prelude.head not found") ( + listToMaybe (do + preludeSymbol <- preludeSymbols + guard (symbolName preludeSymbol == Ident "head") + return preludeSymbol)) + + -- annotate the AST + let annotatedAST = annotate baseEnvironment ast + + -- get all annotations + let annotations = Foldable.toList annotatedAST + + -- filter head Usages in List monad and remove duplicates + let headUsages = nub (do + Scoped (GlobalSymbol globalSymbol _) location <- annotations + guard (globalSymbol == headSymbol) + return location) + + case headUsages of + [] -> + putStrLn "Congratulations! Your code doesn't use Prelude.head" + _ -> forM_ headUsages (\location -> + putStrLn ("Prelude.head is used at " ++ (prettyPrint (srcInfoSpan location)))) ``` @@ -230,25 +153,18 @@ main = do See [haskell-names haddock documentation][doc-index]. -The two modules you need are: - -* [Language.Haskell.Names][] — exports the core functions and data types -* [Language.Haskell.Names.Interfaces][] — lets you work with haskell-names interface files +The core module you need is [Language.Haskell.Names][] Other modules are more experimental, less documented, and you probably don't need them anyway. [doc-index]: http://haskell-suite.github.io/docs/haskell-names/ [Language.haskell.Names]: http://haskell-suite.github.io/docs/haskell-names/Language-Haskell-Names.html -[Language.Haskell.Names.Interfaces]: http://haskell-suite.github.io/docs/haskell-names/Language-Haskell-Names-Interfaces.html ### Known issues See the [list of all issues][issues]. -* Because a non-trivial amount of packages are not designed to work with - anything except GHC, hs-gen-iface currently pretends to be GHC. This is of - course not acceptable — contributions here are welcome. ([#32][]) * haskell-names doesn't perform validation yet. If a module is not valid Haskell, then the behaviour is undefined. See the issues marked as [validation][]. @@ -270,3 +186,4 @@ Maintainers [Adam Bergmark](https://github.com/bergmark) is the backup maintainer. Please get in touch with him if the primary maintainer cannot be reached. + diff --git a/libraries/base-4.7.0.0/Control/Applicative.names b/data/baseEnvironment/Control.Applicative.symbols similarity index 100% rename from libraries/base-4.7.0.0/Control/Applicative.names rename to data/baseEnvironment/Control.Applicative.symbols diff --git a/libraries/base-4.7.0.0/Control/Arrow.names b/data/baseEnvironment/Control.Arrow.symbols similarity index 100% rename from libraries/base-4.7.0.0/Control/Arrow.names rename to data/baseEnvironment/Control.Arrow.symbols diff --git a/libraries/base-4.7.0.0/Control/Category.names b/data/baseEnvironment/Control.Category.symbols similarity index 100% rename from libraries/base-4.7.0.0/Control/Category.names rename to data/baseEnvironment/Control.Category.symbols diff --git a/libraries/base-4.7.0.0/Control/Concurrent/Chan.names b/data/baseEnvironment/Control.Concurrent.Chan.symbols similarity index 100% rename from libraries/base-4.7.0.0/Control/Concurrent/Chan.names rename to data/baseEnvironment/Control.Concurrent.Chan.symbols diff --git a/libraries/base-4.7.0.0/Control/Concurrent/MVar.names b/data/baseEnvironment/Control.Concurrent.MVar.symbols similarity index 100% rename from libraries/base-4.7.0.0/Control/Concurrent/MVar.names rename to data/baseEnvironment/Control.Concurrent.MVar.symbols diff --git a/libraries/base-4.7.0.0/Control/Concurrent/QSem.names b/data/baseEnvironment/Control.Concurrent.QSem.symbols similarity index 100% rename from libraries/base-4.7.0.0/Control/Concurrent/QSem.names rename to data/baseEnvironment/Control.Concurrent.QSem.symbols diff --git a/libraries/base-4.7.0.0/Control/Concurrent/QSemN.names b/data/baseEnvironment/Control.Concurrent.QSemN.symbols similarity index 100% rename from libraries/base-4.7.0.0/Control/Concurrent/QSemN.names rename to data/baseEnvironment/Control.Concurrent.QSemN.symbols diff --git a/libraries/base-4.7.0.0/Control/Concurrent.names b/data/baseEnvironment/Control.Concurrent.symbols similarity index 100% rename from libraries/base-4.7.0.0/Control/Concurrent.names rename to data/baseEnvironment/Control.Concurrent.symbols diff --git a/libraries/base-4.7.0.0/Control/Exception/Base.names b/data/baseEnvironment/Control.Exception.Base.symbols similarity index 100% rename from libraries/base-4.7.0.0/Control/Exception/Base.names rename to data/baseEnvironment/Control.Exception.Base.symbols diff --git a/libraries/base-4.7.0.0/Control/Exception.names b/data/baseEnvironment/Control.Exception.symbols similarity index 100% rename from libraries/base-4.7.0.0/Control/Exception.names rename to data/baseEnvironment/Control.Exception.symbols diff --git a/libraries/base-4.7.0.0/Control/Monad/Fix.names b/data/baseEnvironment/Control.Monad.Fix.symbols similarity index 100% rename from libraries/base-4.7.0.0/Control/Monad/Fix.names rename to data/baseEnvironment/Control.Monad.Fix.symbols diff --git a/libraries/base-4.7.0.0/Control/Monad/Instances.names b/data/baseEnvironment/Control.Monad.Instances.symbols similarity index 100% rename from libraries/base-4.7.0.0/Control/Monad/Instances.names rename to data/baseEnvironment/Control.Monad.Instances.symbols diff --git a/libraries/base-4.7.0.0/Control/Monad/ST/Imp.names b/data/baseEnvironment/Control.Monad.ST.Imp.symbols similarity index 100% rename from libraries/base-4.7.0.0/Control/Monad/ST/Imp.names rename to data/baseEnvironment/Control.Monad.ST.Imp.symbols diff --git a/libraries/base-4.7.0.0/Control/Monad/ST/Lazy/Imp.names b/data/baseEnvironment/Control.Monad.ST.Lazy.Imp.symbols similarity index 100% rename from libraries/base-4.7.0.0/Control/Monad/ST/Lazy/Imp.names rename to data/baseEnvironment/Control.Monad.ST.Lazy.Imp.symbols diff --git a/libraries/base-4.7.0.0/Control/Monad/ST/Lazy/Safe.names b/data/baseEnvironment/Control.Monad.ST.Lazy.Safe.symbols similarity index 100% rename from libraries/base-4.7.0.0/Control/Monad/ST/Lazy/Safe.names rename to data/baseEnvironment/Control.Monad.ST.Lazy.Safe.symbols diff --git a/libraries/base-4.7.0.0/Control/Monad/ST/Lazy/Unsafe.names b/data/baseEnvironment/Control.Monad.ST.Lazy.Unsafe.symbols similarity index 100% rename from libraries/base-4.7.0.0/Control/Monad/ST/Lazy/Unsafe.names rename to data/baseEnvironment/Control.Monad.ST.Lazy.Unsafe.symbols diff --git a/libraries/base-4.7.0.0/Control/Monad/ST/Lazy.names b/data/baseEnvironment/Control.Monad.ST.Lazy.symbols similarity index 100% rename from libraries/base-4.7.0.0/Control/Monad/ST/Lazy.names rename to data/baseEnvironment/Control.Monad.ST.Lazy.symbols diff --git a/libraries/base-4.7.0.0/Control/Monad/ST/Safe.names b/data/baseEnvironment/Control.Monad.ST.Safe.symbols similarity index 100% rename from libraries/base-4.7.0.0/Control/Monad/ST/Safe.names rename to data/baseEnvironment/Control.Monad.ST.Safe.symbols diff --git a/libraries/base-4.7.0.0/Control/Monad/ST/Strict.names b/data/baseEnvironment/Control.Monad.ST.Strict.symbols similarity index 100% rename from libraries/base-4.7.0.0/Control/Monad/ST/Strict.names rename to data/baseEnvironment/Control.Monad.ST.Strict.symbols diff --git a/libraries/base-4.7.0.0/Control/Monad/ST/Unsafe.names b/data/baseEnvironment/Control.Monad.ST.Unsafe.symbols similarity index 100% rename from libraries/base-4.7.0.0/Control/Monad/ST/Unsafe.names rename to data/baseEnvironment/Control.Monad.ST.Unsafe.symbols diff --git a/libraries/base-4.7.0.0/Control/Monad/ST.names b/data/baseEnvironment/Control.Monad.ST.symbols similarity index 100% rename from libraries/base-4.7.0.0/Control/Monad/ST.names rename to data/baseEnvironment/Control.Monad.ST.symbols diff --git a/libraries/base-4.7.0.0/Control/Monad/Zip.names b/data/baseEnvironment/Control.Monad.Zip.symbols similarity index 100% rename from libraries/base-4.7.0.0/Control/Monad/Zip.names rename to data/baseEnvironment/Control.Monad.Zip.symbols diff --git a/libraries/base-4.7.0.0/Control/Monad.names b/data/baseEnvironment/Control.Monad.symbols similarity index 100% rename from libraries/base-4.7.0.0/Control/Monad.names rename to data/baseEnvironment/Control.Monad.symbols diff --git a/libraries/base-4.7.0.0/Data/Bits.names b/data/baseEnvironment/Data.Bits.symbols similarity index 100% rename from libraries/base-4.7.0.0/Data/Bits.names rename to data/baseEnvironment/Data.Bits.symbols diff --git a/libraries/base-4.7.0.0/Data/Bool.names b/data/baseEnvironment/Data.Bool.symbols similarity index 100% rename from libraries/base-4.7.0.0/Data/Bool.names rename to data/baseEnvironment/Data.Bool.symbols diff --git a/libraries/base-4.7.0.0/Data/Char.names b/data/baseEnvironment/Data.Char.symbols similarity index 100% rename from libraries/base-4.7.0.0/Data/Char.names rename to data/baseEnvironment/Data.Char.symbols diff --git a/libraries/base-4.7.0.0/Data/Complex.names b/data/baseEnvironment/Data.Complex.symbols similarity index 100% rename from libraries/base-4.7.0.0/Data/Complex.names rename to data/baseEnvironment/Data.Complex.symbols diff --git a/libraries/base-4.7.0.0/Data/Data.names b/data/baseEnvironment/Data.Data.symbols similarity index 100% rename from libraries/base-4.7.0.0/Data/Data.names rename to data/baseEnvironment/Data.Data.symbols diff --git a/libraries/base-4.7.0.0/Data/Dynamic.names b/data/baseEnvironment/Data.Dynamic.symbols similarity index 100% rename from libraries/base-4.7.0.0/Data/Dynamic.names rename to data/baseEnvironment/Data.Dynamic.symbols diff --git a/libraries/base-4.7.0.0/Data/Either.names b/data/baseEnvironment/Data.Either.symbols similarity index 100% rename from libraries/base-4.7.0.0/Data/Either.names rename to data/baseEnvironment/Data.Either.symbols diff --git a/libraries/base-4.7.0.0/Data/Eq.names b/data/baseEnvironment/Data.Eq.symbols similarity index 100% rename from libraries/base-4.7.0.0/Data/Eq.names rename to data/baseEnvironment/Data.Eq.symbols diff --git a/libraries/base-4.7.0.0/Data/Fixed.names b/data/baseEnvironment/Data.Fixed.symbols similarity index 100% rename from libraries/base-4.7.0.0/Data/Fixed.names rename to data/baseEnvironment/Data.Fixed.symbols diff --git a/libraries/base-4.7.0.0/Data/Foldable.names b/data/baseEnvironment/Data.Foldable.symbols similarity index 100% rename from libraries/base-4.7.0.0/Data/Foldable.names rename to data/baseEnvironment/Data.Foldable.symbols diff --git a/libraries/base-4.7.0.0/Data/Function.names b/data/baseEnvironment/Data.Function.symbols similarity index 100% rename from libraries/base-4.7.0.0/Data/Function.names rename to data/baseEnvironment/Data.Function.symbols diff --git a/libraries/base-4.7.0.0/Data/Functor.names b/data/baseEnvironment/Data.Functor.symbols similarity index 100% rename from libraries/base-4.7.0.0/Data/Functor.names rename to data/baseEnvironment/Data.Functor.symbols diff --git a/libraries/base-4.7.0.0/Data/IORef.names b/data/baseEnvironment/Data.IORef.symbols similarity index 100% rename from libraries/base-4.7.0.0/Data/IORef.names rename to data/baseEnvironment/Data.IORef.symbols diff --git a/libraries/base-4.7.0.0/Data/Int.names b/data/baseEnvironment/Data.Int.symbols similarity index 100% rename from libraries/base-4.7.0.0/Data/Int.names rename to data/baseEnvironment/Data.Int.symbols diff --git a/libraries/base-4.7.0.0/Data/Ix.names b/data/baseEnvironment/Data.Ix.symbols similarity index 100% rename from libraries/base-4.7.0.0/Data/Ix.names rename to data/baseEnvironment/Data.Ix.symbols diff --git a/libraries/base-4.7.0.0/Data/List.names b/data/baseEnvironment/Data.List.symbols similarity index 100% rename from libraries/base-4.7.0.0/Data/List.names rename to data/baseEnvironment/Data.List.symbols diff --git a/libraries/base-4.7.0.0/Data/Maybe.names b/data/baseEnvironment/Data.Maybe.symbols similarity index 100% rename from libraries/base-4.7.0.0/Data/Maybe.names rename to data/baseEnvironment/Data.Maybe.symbols diff --git a/libraries/base-4.7.0.0/Data/Monoid.names b/data/baseEnvironment/Data.Monoid.symbols similarity index 100% rename from libraries/base-4.7.0.0/Data/Monoid.names rename to data/baseEnvironment/Data.Monoid.symbols diff --git a/libraries/base-4.7.0.0/Data/OldTypeable/Internal.names b/data/baseEnvironment/Data.OldTypeable.Internal.symbols similarity index 100% rename from libraries/base-4.7.0.0/Data/OldTypeable/Internal.names rename to data/baseEnvironment/Data.OldTypeable.Internal.symbols diff --git a/libraries/base-4.7.0.0/Data/OldTypeable.names b/data/baseEnvironment/Data.OldTypeable.symbols similarity index 100% rename from libraries/base-4.7.0.0/Data/OldTypeable.names rename to data/baseEnvironment/Data.OldTypeable.symbols diff --git a/libraries/base-4.7.0.0/Data/Ord.names b/data/baseEnvironment/Data.Ord.symbols similarity index 100% rename from libraries/base-4.7.0.0/Data/Ord.names rename to data/baseEnvironment/Data.Ord.symbols diff --git a/libraries/base-4.7.0.0/Data/Ratio.names b/data/baseEnvironment/Data.Ratio.symbols similarity index 100% rename from libraries/base-4.7.0.0/Data/Ratio.names rename to data/baseEnvironment/Data.Ratio.symbols diff --git a/libraries/base-4.7.0.0/Data/STRef/Lazy.names b/data/baseEnvironment/Data.STRef.Lazy.symbols similarity index 100% rename from libraries/base-4.7.0.0/Data/STRef/Lazy.names rename to data/baseEnvironment/Data.STRef.Lazy.symbols diff --git a/libraries/base-4.7.0.0/Data/STRef/Strict.names b/data/baseEnvironment/Data.STRef.Strict.symbols similarity index 100% rename from libraries/base-4.7.0.0/Data/STRef/Strict.names rename to data/baseEnvironment/Data.STRef.Strict.symbols diff --git a/libraries/base-4.7.0.0/Data/STRef.names b/data/baseEnvironment/Data.STRef.symbols similarity index 100% rename from libraries/base-4.7.0.0/Data/STRef.names rename to data/baseEnvironment/Data.STRef.symbols diff --git a/libraries/base-4.7.0.0/Data/String.names b/data/baseEnvironment/Data.String.symbols similarity index 100% rename from libraries/base-4.7.0.0/Data/String.names rename to data/baseEnvironment/Data.String.symbols diff --git a/libraries/base-4.7.0.0/Data/Traversable.names b/data/baseEnvironment/Data.Traversable.symbols similarity index 100% rename from libraries/base-4.7.0.0/Data/Traversable.names rename to data/baseEnvironment/Data.Traversable.symbols diff --git a/libraries/base-4.7.0.0/Data/Tuple.names b/data/baseEnvironment/Data.Tuple.symbols similarity index 100% rename from libraries/base-4.7.0.0/Data/Tuple.names rename to data/baseEnvironment/Data.Tuple.symbols diff --git a/libraries/base-4.7.0.0/Data/Typeable/Internal.names b/data/baseEnvironment/Data.Typeable.Internal.symbols similarity index 100% rename from libraries/base-4.7.0.0/Data/Typeable/Internal.names rename to data/baseEnvironment/Data.Typeable.Internal.symbols diff --git a/libraries/base-4.7.0.0/Data/Typeable.names b/data/baseEnvironment/Data.Typeable.symbols similarity index 100% rename from libraries/base-4.7.0.0/Data/Typeable.names rename to data/baseEnvironment/Data.Typeable.symbols diff --git a/libraries/base-4.7.0.0/Data/Unique.names b/data/baseEnvironment/Data.Unique.symbols similarity index 100% rename from libraries/base-4.7.0.0/Data/Unique.names rename to data/baseEnvironment/Data.Unique.symbols diff --git a/libraries/base-4.7.0.0/Data/Version.names b/data/baseEnvironment/Data.Version.symbols similarity index 100% rename from libraries/base-4.7.0.0/Data/Version.names rename to data/baseEnvironment/Data.Version.symbols diff --git a/libraries/base-4.7.0.0/Data/Word.names b/data/baseEnvironment/Data.Word.symbols similarity index 100% rename from libraries/base-4.7.0.0/Data/Word.names rename to data/baseEnvironment/Data.Word.symbols diff --git a/libraries/base-4.7.0.0/Debug/Trace.names b/data/baseEnvironment/Debug.Trace.symbols similarity index 100% rename from libraries/base-4.7.0.0/Debug/Trace.names rename to data/baseEnvironment/Debug.Trace.symbols diff --git a/libraries/base-4.7.0.0/Foreign/C/Error.names b/data/baseEnvironment/Foreign.C.Error.symbols similarity index 100% rename from libraries/base-4.7.0.0/Foreign/C/Error.names rename to data/baseEnvironment/Foreign.C.Error.symbols diff --git a/libraries/base-4.7.0.0/Foreign/C/String.names b/data/baseEnvironment/Foreign.C.String.symbols similarity index 100% rename from libraries/base-4.7.0.0/Foreign/C/String.names rename to data/baseEnvironment/Foreign.C.String.symbols diff --git a/libraries/base-4.7.0.0/Foreign/C/Types.names b/data/baseEnvironment/Foreign.C.Types.symbols similarity index 100% rename from libraries/base-4.7.0.0/Foreign/C/Types.names rename to data/baseEnvironment/Foreign.C.Types.symbols diff --git a/libraries/base-4.7.0.0/Foreign/C.names b/data/baseEnvironment/Foreign.C.symbols similarity index 100% rename from libraries/base-4.7.0.0/Foreign/C.names rename to data/baseEnvironment/Foreign.C.symbols diff --git a/libraries/base-4.7.0.0/Foreign/Concurrent.names b/data/baseEnvironment/Foreign.Concurrent.symbols similarity index 100% rename from libraries/base-4.7.0.0/Foreign/Concurrent.names rename to data/baseEnvironment/Foreign.Concurrent.symbols diff --git a/libraries/base-4.7.0.0/Foreign/ForeignPtr/Imp.names b/data/baseEnvironment/Foreign.ForeignPtr.Imp.symbols similarity index 100% rename from libraries/base-4.7.0.0/Foreign/ForeignPtr/Imp.names rename to data/baseEnvironment/Foreign.ForeignPtr.Imp.symbols diff --git a/libraries/base-4.7.0.0/Foreign/ForeignPtr.names b/data/baseEnvironment/Foreign.ForeignPtr.Safe.symbols similarity index 100% rename from libraries/base-4.7.0.0/Foreign/ForeignPtr.names rename to data/baseEnvironment/Foreign.ForeignPtr.Safe.symbols diff --git a/libraries/base-4.7.0.0/Foreign/ForeignPtr/Unsafe.names b/data/baseEnvironment/Foreign.ForeignPtr.Unsafe.symbols similarity index 100% rename from libraries/base-4.7.0.0/Foreign/ForeignPtr/Unsafe.names rename to data/baseEnvironment/Foreign.ForeignPtr.Unsafe.symbols diff --git a/libraries/base-4.7.0.0/Foreign/ForeignPtr/Safe.names b/data/baseEnvironment/Foreign.ForeignPtr.symbols similarity index 100% rename from libraries/base-4.7.0.0/Foreign/ForeignPtr/Safe.names rename to data/baseEnvironment/Foreign.ForeignPtr.symbols diff --git a/libraries/base-4.7.0.0/Foreign/Marshal/Alloc.names b/data/baseEnvironment/Foreign.Marshal.Alloc.symbols similarity index 100% rename from libraries/base-4.7.0.0/Foreign/Marshal/Alloc.names rename to data/baseEnvironment/Foreign.Marshal.Alloc.symbols diff --git a/libraries/base-4.7.0.0/Foreign/Marshal/Array.names b/data/baseEnvironment/Foreign.Marshal.Array.symbols similarity index 100% rename from libraries/base-4.7.0.0/Foreign/Marshal/Array.names rename to data/baseEnvironment/Foreign.Marshal.Array.symbols diff --git a/libraries/base-4.7.0.0/Foreign/Marshal/Error.names b/data/baseEnvironment/Foreign.Marshal.Error.symbols similarity index 100% rename from libraries/base-4.7.0.0/Foreign/Marshal/Error.names rename to data/baseEnvironment/Foreign.Marshal.Error.symbols diff --git a/libraries/base-4.7.0.0/Foreign/Marshal/Pool.names b/data/baseEnvironment/Foreign.Marshal.Pool.symbols similarity index 100% rename from libraries/base-4.7.0.0/Foreign/Marshal/Pool.names rename to data/baseEnvironment/Foreign.Marshal.Pool.symbols diff --git a/libraries/base-4.7.0.0/Foreign/Marshal/Safe.names b/data/baseEnvironment/Foreign.Marshal.Safe.symbols similarity index 100% rename from libraries/base-4.7.0.0/Foreign/Marshal/Safe.names rename to data/baseEnvironment/Foreign.Marshal.Safe.symbols diff --git a/libraries/base-4.7.0.0/Foreign/Marshal/Unsafe.names b/data/baseEnvironment/Foreign.Marshal.Unsafe.symbols similarity index 100% rename from libraries/base-4.7.0.0/Foreign/Marshal/Unsafe.names rename to data/baseEnvironment/Foreign.Marshal.Unsafe.symbols diff --git a/libraries/base-4.7.0.0/Foreign/Marshal/Utils.names b/data/baseEnvironment/Foreign.Marshal.Utils.symbols similarity index 100% rename from libraries/base-4.7.0.0/Foreign/Marshal/Utils.names rename to data/baseEnvironment/Foreign.Marshal.Utils.symbols diff --git a/libraries/base-4.7.0.0/Foreign/Marshal.names b/data/baseEnvironment/Foreign.Marshal.symbols similarity index 100% rename from libraries/base-4.7.0.0/Foreign/Marshal.names rename to data/baseEnvironment/Foreign.Marshal.symbols diff --git a/libraries/base-4.7.0.0/Foreign/Ptr.names b/data/baseEnvironment/Foreign.Ptr.symbols similarity index 100% rename from libraries/base-4.7.0.0/Foreign/Ptr.names rename to data/baseEnvironment/Foreign.Ptr.symbols diff --git a/libraries/base-4.7.0.0/Foreign.names b/data/baseEnvironment/Foreign.Safe.symbols similarity index 100% rename from libraries/base-4.7.0.0/Foreign.names rename to data/baseEnvironment/Foreign.Safe.symbols diff --git a/libraries/base-4.7.0.0/Foreign/StablePtr.names b/data/baseEnvironment/Foreign.StablePtr.symbols similarity index 100% rename from libraries/base-4.7.0.0/Foreign/StablePtr.names rename to data/baseEnvironment/Foreign.StablePtr.symbols diff --git a/libraries/base-4.7.0.0/Foreign/Storable.names b/data/baseEnvironment/Foreign.Storable.symbols similarity index 100% rename from libraries/base-4.7.0.0/Foreign/Storable.names rename to data/baseEnvironment/Foreign.Storable.symbols diff --git a/libraries/base-4.7.0.0/Foreign/Safe.names b/data/baseEnvironment/Foreign.symbols similarity index 100% rename from libraries/base-4.7.0.0/Foreign/Safe.names rename to data/baseEnvironment/Foreign.symbols diff --git a/libraries/base-4.7.0.0/GHC/Arr.names b/data/baseEnvironment/GHC.Arr.symbols similarity index 100% rename from libraries/base-4.7.0.0/GHC/Arr.names rename to data/baseEnvironment/GHC.Arr.symbols diff --git a/libraries/base-4.7.0.0/GHC/Base.names b/data/baseEnvironment/GHC.Base.symbols similarity index 100% rename from libraries/base-4.7.0.0/GHC/Base.names rename to data/baseEnvironment/GHC.Base.symbols diff --git a/libraries/ghc-prim-0.3.1.0/GHC/CString.names b/data/baseEnvironment/GHC.CString.symbols similarity index 100% rename from libraries/ghc-prim-0.3.1.0/GHC/CString.names rename to data/baseEnvironment/GHC.CString.symbols diff --git a/libraries/base-4.7.0.0/GHC/Char.names b/data/baseEnvironment/GHC.Char.symbols similarity index 100% rename from libraries/base-4.7.0.0/GHC/Char.names rename to data/baseEnvironment/GHC.Char.symbols diff --git a/libraries/ghc-prim-0.3.1.0/GHC/Classes.names b/data/baseEnvironment/GHC.Classes.symbols similarity index 100% rename from libraries/ghc-prim-0.3.1.0/GHC/Classes.names rename to data/baseEnvironment/GHC.Classes.symbols diff --git a/libraries/base-4.7.0.0/GHC/Conc/IO.names b/data/baseEnvironment/GHC.Conc.IO.symbols similarity index 100% rename from libraries/base-4.7.0.0/GHC/Conc/IO.names rename to data/baseEnvironment/GHC.Conc.IO.symbols diff --git a/libraries/base-4.7.0.0/GHC/Conc/Signal.names b/data/baseEnvironment/GHC.Conc.Signal.symbols similarity index 100% rename from libraries/base-4.7.0.0/GHC/Conc/Signal.names rename to data/baseEnvironment/GHC.Conc.Signal.symbols diff --git a/libraries/base-4.7.0.0/GHC/Conc/Sync.names b/data/baseEnvironment/GHC.Conc.Sync.symbols similarity index 100% rename from libraries/base-4.7.0.0/GHC/Conc/Sync.names rename to data/baseEnvironment/GHC.Conc.Sync.symbols diff --git a/libraries/base-4.7.0.0/GHC/Conc.names b/data/baseEnvironment/GHC.Conc.symbols similarity index 100% rename from libraries/base-4.7.0.0/GHC/Conc.names rename to data/baseEnvironment/GHC.Conc.symbols diff --git a/libraries/base-4.7.0.0/GHC/ConsoleHandler.names b/data/baseEnvironment/GHC.ConsoleHandler.symbols similarity index 100% rename from libraries/base-4.7.0.0/GHC/ConsoleHandler.names rename to data/baseEnvironment/GHC.ConsoleHandler.symbols diff --git a/libraries/base-4.7.0.0/GHC/Constants.names b/data/baseEnvironment/GHC.Constants.symbols similarity index 100% rename from libraries/base-4.7.0.0/GHC/Constants.names rename to data/baseEnvironment/GHC.Constants.symbols diff --git a/libraries/ghc-prim-0.3.1.0/GHC/Debug.names b/data/baseEnvironment/GHC.Debug.symbols similarity index 100% rename from libraries/ghc-prim-0.3.1.0/GHC/Debug.names rename to data/baseEnvironment/GHC.Debug.symbols diff --git a/libraries/base-4.7.0.0/GHC/Desugar.names b/data/baseEnvironment/GHC.Desugar.symbols similarity index 100% rename from libraries/base-4.7.0.0/GHC/Desugar.names rename to data/baseEnvironment/GHC.Desugar.symbols diff --git a/libraries/base-4.7.0.0/GHC/Enum.names b/data/baseEnvironment/GHC.Enum.symbols similarity index 100% rename from libraries/base-4.7.0.0/GHC/Enum.names rename to data/baseEnvironment/GHC.Enum.symbols diff --git a/libraries/base-4.7.0.0/GHC/Environment.names b/data/baseEnvironment/GHC.Environment.symbols similarity index 100% rename from libraries/base-4.7.0.0/GHC/Environment.names rename to data/baseEnvironment/GHC.Environment.symbols diff --git a/libraries/base-4.7.0.0/GHC/Err.names b/data/baseEnvironment/GHC.Err.symbols similarity index 100% rename from libraries/base-4.7.0.0/GHC/Err.names rename to data/baseEnvironment/GHC.Err.symbols diff --git a/libraries/base-4.7.0.0/GHC/Event/Array.names b/data/baseEnvironment/GHC.Event.Array.symbols similarity index 100% rename from libraries/base-4.7.0.0/GHC/Event/Array.names rename to data/baseEnvironment/GHC.Event.Array.symbols diff --git a/libraries/base-4.7.0.0/GHC/Event/Clock.names b/data/baseEnvironment/GHC.Event.Clock.symbols similarity index 100% rename from libraries/base-4.7.0.0/GHC/Event/Clock.names rename to data/baseEnvironment/GHC.Event.Clock.symbols diff --git a/libraries/base-4.7.0.0/GHC/Event/Control.names b/data/baseEnvironment/GHC.Event.Control.symbols similarity index 100% rename from libraries/base-4.7.0.0/GHC/Event/Control.names rename to data/baseEnvironment/GHC.Event.Control.symbols diff --git a/libraries/base-4.7.0.0/GHC/Event/EPoll.names b/data/baseEnvironment/GHC.Event.EPoll.symbols similarity index 100% rename from libraries/base-4.7.0.0/GHC/Event/EPoll.names rename to data/baseEnvironment/GHC.Event.EPoll.symbols diff --git a/libraries/base-4.7.0.0/GHC/Event/IntMap.names b/data/baseEnvironment/GHC.Event.IntMap.symbols similarity index 100% rename from libraries/base-4.7.0.0/GHC/Event/IntMap.names rename to data/baseEnvironment/GHC.Event.IntMap.symbols diff --git a/libraries/base-4.7.0.0/GHC/Event/Internal.names b/data/baseEnvironment/GHC.Event.Internal.symbols similarity index 100% rename from libraries/base-4.7.0.0/GHC/Event/Internal.names rename to data/baseEnvironment/GHC.Event.Internal.symbols diff --git a/libraries/base-4.7.0.0/GHC/Event/KQueue.names b/data/baseEnvironment/GHC.Event.KQueue.symbols similarity index 100% rename from libraries/base-4.7.0.0/GHC/Event/KQueue.names rename to data/baseEnvironment/GHC.Event.KQueue.symbols diff --git a/libraries/base-4.7.0.0/GHC/Event/Manager.names b/data/baseEnvironment/GHC.Event.Manager.symbols similarity index 100% rename from libraries/base-4.7.0.0/GHC/Event/Manager.names rename to data/baseEnvironment/GHC.Event.Manager.symbols diff --git a/libraries/base-4.7.0.0/GHC/Event/PSQ.names b/data/baseEnvironment/GHC.Event.PSQ.symbols similarity index 100% rename from libraries/base-4.7.0.0/GHC/Event/PSQ.names rename to data/baseEnvironment/GHC.Event.PSQ.symbols diff --git a/libraries/base-4.7.0.0/GHC/Event/Poll.names b/data/baseEnvironment/GHC.Event.Poll.symbols similarity index 100% rename from libraries/base-4.7.0.0/GHC/Event/Poll.names rename to data/baseEnvironment/GHC.Event.Poll.symbols diff --git a/libraries/base-4.7.0.0/GHC/Event/Thread.names b/data/baseEnvironment/GHC.Event.Thread.symbols similarity index 100% rename from libraries/base-4.7.0.0/GHC/Event/Thread.names rename to data/baseEnvironment/GHC.Event.Thread.symbols diff --git a/libraries/base-4.7.0.0/GHC/Event/TimerManager.names b/data/baseEnvironment/GHC.Event.TimerManager.symbols similarity index 100% rename from libraries/base-4.7.0.0/GHC/Event/TimerManager.names rename to data/baseEnvironment/GHC.Event.TimerManager.symbols diff --git a/libraries/base-4.7.0.0/GHC/Event/Unique.names b/data/baseEnvironment/GHC.Event.Unique.symbols similarity index 100% rename from libraries/base-4.7.0.0/GHC/Event/Unique.names rename to data/baseEnvironment/GHC.Event.Unique.symbols diff --git a/libraries/base-4.7.0.0/GHC/Event.names b/data/baseEnvironment/GHC.Event.symbols similarity index 100% rename from libraries/base-4.7.0.0/GHC/Event.names rename to data/baseEnvironment/GHC.Event.symbols diff --git a/libraries/base-4.7.0.0/GHC/Exception.names b/data/baseEnvironment/GHC.Exception.symbols similarity index 100% rename from libraries/base-4.7.0.0/GHC/Exception.names rename to data/baseEnvironment/GHC.Exception.symbols diff --git a/libraries/base-4.7.0.0/GHC/Exts.names b/data/baseEnvironment/GHC.Exts.symbols similarity index 100% rename from libraries/base-4.7.0.0/GHC/Exts.names rename to data/baseEnvironment/GHC.Exts.symbols diff --git a/libraries/base-4.7.0.0/GHC/Fingerprint/Type.names b/data/baseEnvironment/GHC.Fingerprint.Type.symbols similarity index 100% rename from libraries/base-4.7.0.0/GHC/Fingerprint/Type.names rename to data/baseEnvironment/GHC.Fingerprint.Type.symbols diff --git a/libraries/base-4.7.0.0/GHC/Fingerprint.names b/data/baseEnvironment/GHC.Fingerprint.symbols similarity index 100% rename from libraries/base-4.7.0.0/GHC/Fingerprint.names rename to data/baseEnvironment/GHC.Fingerprint.symbols diff --git a/libraries/base-4.7.0.0/GHC/Float/ConversionUtils.names b/data/baseEnvironment/GHC.Float.ConversionUtils.symbols similarity index 100% rename from libraries/base-4.7.0.0/GHC/Float/ConversionUtils.names rename to data/baseEnvironment/GHC.Float.ConversionUtils.symbols diff --git a/libraries/base-4.7.0.0/GHC/Float/RealFracMethods.names b/data/baseEnvironment/GHC.Float.RealFracMethods.symbols similarity index 100% rename from libraries/base-4.7.0.0/GHC/Float/RealFracMethods.names rename to data/baseEnvironment/GHC.Float.RealFracMethods.symbols diff --git a/libraries/base-4.7.0.0/GHC/Float.names b/data/baseEnvironment/GHC.Float.symbols similarity index 100% rename from libraries/base-4.7.0.0/GHC/Float.names rename to data/baseEnvironment/GHC.Float.symbols diff --git a/libraries/base-4.7.0.0/GHC/Foreign.names b/data/baseEnvironment/GHC.Foreign.symbols similarity index 100% rename from libraries/base-4.7.0.0/GHC/Foreign.names rename to data/baseEnvironment/GHC.Foreign.symbols diff --git a/libraries/base-4.7.0.0/GHC/ForeignPtr.names b/data/baseEnvironment/GHC.ForeignPtr.symbols similarity index 100% rename from libraries/base-4.7.0.0/GHC/ForeignPtr.names rename to data/baseEnvironment/GHC.ForeignPtr.symbols diff --git a/libraries/base-4.7.0.0/GHC/GHCi.names b/data/baseEnvironment/GHC.GHCi.symbols similarity index 100% rename from libraries/base-4.7.0.0/GHC/GHCi.names rename to data/baseEnvironment/GHC.GHCi.symbols diff --git a/libraries/base-4.7.0.0/GHC/Generics.names b/data/baseEnvironment/GHC.Generics.symbols similarity index 100% rename from libraries/base-4.7.0.0/GHC/Generics.names rename to data/baseEnvironment/GHC.Generics.symbols diff --git a/libraries/base-4.7.0.0/GHC/IO/Buffer.names b/data/baseEnvironment/GHC.IO.Buffer.symbols similarity index 100% rename from libraries/base-4.7.0.0/GHC/IO/Buffer.names rename to data/baseEnvironment/GHC.IO.Buffer.symbols diff --git a/libraries/base-4.7.0.0/GHC/IO/BufferedIO.names b/data/baseEnvironment/GHC.IO.BufferedIO.symbols similarity index 100% rename from libraries/base-4.7.0.0/GHC/IO/BufferedIO.names rename to data/baseEnvironment/GHC.IO.BufferedIO.symbols diff --git a/libraries/base-4.7.0.0/GHC/IO/Device.names b/data/baseEnvironment/GHC.IO.Device.symbols similarity index 100% rename from libraries/base-4.7.0.0/GHC/IO/Device.names rename to data/baseEnvironment/GHC.IO.Device.symbols diff --git a/libraries/base-4.7.0.0/GHC/IO/Encoding/CodePage.names b/data/baseEnvironment/GHC.IO.Encoding.CodePage.symbols similarity index 100% rename from libraries/base-4.7.0.0/GHC/IO/Encoding/CodePage.names rename to data/baseEnvironment/GHC.IO.Encoding.CodePage.symbols diff --git a/libraries/base-4.7.0.0/GHC/IO/Encoding/Failure.names b/data/baseEnvironment/GHC.IO.Encoding.Failure.symbols similarity index 100% rename from libraries/base-4.7.0.0/GHC/IO/Encoding/Failure.names rename to data/baseEnvironment/GHC.IO.Encoding.Failure.symbols diff --git a/libraries/base-4.7.0.0/GHC/IO/Encoding/Iconv.names b/data/baseEnvironment/GHC.IO.Encoding.Iconv.symbols similarity index 100% rename from libraries/base-4.7.0.0/GHC/IO/Encoding/Iconv.names rename to data/baseEnvironment/GHC.IO.Encoding.Iconv.symbols diff --git a/libraries/base-4.7.0.0/GHC/IO/Encoding/Latin1.names b/data/baseEnvironment/GHC.IO.Encoding.Latin1.symbols similarity index 100% rename from libraries/base-4.7.0.0/GHC/IO/Encoding/Latin1.names rename to data/baseEnvironment/GHC.IO.Encoding.Latin1.symbols diff --git a/libraries/base-4.7.0.0/GHC/IO/Encoding/Types.names b/data/baseEnvironment/GHC.IO.Encoding.Types.symbols similarity index 100% rename from libraries/base-4.7.0.0/GHC/IO/Encoding/Types.names rename to data/baseEnvironment/GHC.IO.Encoding.Types.symbols diff --git a/libraries/base-4.7.0.0/GHC/IO/Encoding/UTF16.names b/data/baseEnvironment/GHC.IO.Encoding.UTF16.symbols similarity index 100% rename from libraries/base-4.7.0.0/GHC/IO/Encoding/UTF16.names rename to data/baseEnvironment/GHC.IO.Encoding.UTF16.symbols diff --git a/libraries/base-4.7.0.0/GHC/IO/Encoding/UTF32.names b/data/baseEnvironment/GHC.IO.Encoding.UTF32.symbols similarity index 100% rename from libraries/base-4.7.0.0/GHC/IO/Encoding/UTF32.names rename to data/baseEnvironment/GHC.IO.Encoding.UTF32.symbols diff --git a/libraries/base-4.7.0.0/GHC/IO/Encoding/UTF8.names b/data/baseEnvironment/GHC.IO.Encoding.UTF8.symbols similarity index 100% rename from libraries/base-4.7.0.0/GHC/IO/Encoding/UTF8.names rename to data/baseEnvironment/GHC.IO.Encoding.UTF8.symbols diff --git a/libraries/base-4.7.0.0/GHC/IO/Encoding.names b/data/baseEnvironment/GHC.IO.Encoding.symbols similarity index 100% rename from libraries/base-4.7.0.0/GHC/IO/Encoding.names rename to data/baseEnvironment/GHC.IO.Encoding.symbols diff --git a/libraries/base-4.7.0.0/GHC/IO/Exception.names b/data/baseEnvironment/GHC.IO.Exception.symbols similarity index 100% rename from libraries/base-4.7.0.0/GHC/IO/Exception.names rename to data/baseEnvironment/GHC.IO.Exception.symbols diff --git a/libraries/base-4.7.0.0/GHC/IO/FD.names b/data/baseEnvironment/GHC.IO.FD.symbols similarity index 100% rename from libraries/base-4.7.0.0/GHC/IO/FD.names rename to data/baseEnvironment/GHC.IO.FD.symbols diff --git a/libraries/base-4.7.0.0/GHC/IO/Handle/FD.names b/data/baseEnvironment/GHC.IO.Handle.FD.symbols similarity index 100% rename from libraries/base-4.7.0.0/GHC/IO/Handle/FD.names rename to data/baseEnvironment/GHC.IO.Handle.FD.symbols diff --git a/libraries/base-4.7.0.0/GHC/IO/Handle/Internals.names b/data/baseEnvironment/GHC.IO.Handle.Internals.symbols similarity index 100% rename from libraries/base-4.7.0.0/GHC/IO/Handle/Internals.names rename to data/baseEnvironment/GHC.IO.Handle.Internals.symbols diff --git a/libraries/base-4.7.0.0/GHC/IO/Handle/Text.names b/data/baseEnvironment/GHC.IO.Handle.Text.symbols similarity index 100% rename from libraries/base-4.7.0.0/GHC/IO/Handle/Text.names rename to data/baseEnvironment/GHC.IO.Handle.Text.symbols diff --git a/libraries/base-4.7.0.0/GHC/IO/Handle/Types.names b/data/baseEnvironment/GHC.IO.Handle.Types.symbols similarity index 100% rename from libraries/base-4.7.0.0/GHC/IO/Handle/Types.names rename to data/baseEnvironment/GHC.IO.Handle.Types.symbols diff --git a/libraries/base-4.7.0.0/GHC/IO/Handle.names b/data/baseEnvironment/GHC.IO.Handle.symbols similarity index 100% rename from libraries/base-4.7.0.0/GHC/IO/Handle.names rename to data/baseEnvironment/GHC.IO.Handle.symbols diff --git a/libraries/base-4.7.0.0/GHC/IO/IOMode.names b/data/baseEnvironment/GHC.IO.IOMode.symbols similarity index 100% rename from libraries/base-4.7.0.0/GHC/IO/IOMode.names rename to data/baseEnvironment/GHC.IO.IOMode.symbols diff --git a/libraries/base-4.7.0.0/GHC/IO.names b/data/baseEnvironment/GHC.IO.symbols similarity index 100% rename from libraries/base-4.7.0.0/GHC/IO.names rename to data/baseEnvironment/GHC.IO.symbols diff --git a/libraries/base-4.7.0.0/GHC/IOArray.names b/data/baseEnvironment/GHC.IOArray.symbols similarity index 100% rename from libraries/base-4.7.0.0/GHC/IOArray.names rename to data/baseEnvironment/GHC.IOArray.symbols diff --git a/libraries/base-4.7.0.0/GHC/IORef.names b/data/baseEnvironment/GHC.IORef.symbols similarity index 100% rename from libraries/base-4.7.0.0/GHC/IORef.names rename to data/baseEnvironment/GHC.IORef.symbols diff --git a/libraries/base-4.7.0.0/GHC/IP.names b/data/baseEnvironment/GHC.IP.symbols similarity index 100% rename from libraries/base-4.7.0.0/GHC/IP.names rename to data/baseEnvironment/GHC.IP.symbols diff --git a/libraries/base-4.7.0.0/GHC/Int.names b/data/baseEnvironment/GHC.Int.symbols similarity index 100% rename from libraries/base-4.7.0.0/GHC/Int.names rename to data/baseEnvironment/GHC.Int.symbols diff --git a/libraries/base-4.7.0.0/GHC/PArr.names b/data/baseEnvironment/GHC.IntWord64.symbols similarity index 100% rename from libraries/base-4.7.0.0/GHC/PArr.names rename to data/baseEnvironment/GHC.IntWord64.symbols diff --git a/libraries/integer-simple-0.1.1.0/GHC/Integer/Logarithms/Internals.names b/data/baseEnvironment/GHC.Integer.Logarithms.Internals.symbols similarity index 100% rename from libraries/integer-simple-0.1.1.0/GHC/Integer/Logarithms/Internals.names rename to data/baseEnvironment/GHC.Integer.Logarithms.Internals.symbols diff --git a/libraries/integer-simple-0.1.1.0/GHC/Integer/Logarithms.names b/data/baseEnvironment/GHC.Integer.Logarithms.symbols similarity index 100% rename from libraries/integer-simple-0.1.1.0/GHC/Integer/Logarithms.names rename to data/baseEnvironment/GHC.Integer.Logarithms.symbols diff --git a/libraries/integer-simple-0.1.1.0/GHC/Integer/Simple/Internals.names b/data/baseEnvironment/GHC.Integer.Simple.Internals.symbols similarity index 100% rename from libraries/integer-simple-0.1.1.0/GHC/Integer/Simple/Internals.names rename to data/baseEnvironment/GHC.Integer.Simple.Internals.symbols diff --git a/libraries/integer-simple-0.1.1.0/GHC/Integer/Type.names b/data/baseEnvironment/GHC.Integer.Type.symbols similarity index 100% rename from libraries/integer-simple-0.1.1.0/GHC/Integer/Type.names rename to data/baseEnvironment/GHC.Integer.Type.symbols diff --git a/libraries/integer-simple-0.1.1.0/GHC/Integer.names b/data/baseEnvironment/GHC.Integer.symbols similarity index 100% rename from libraries/integer-simple-0.1.1.0/GHC/Integer.names rename to data/baseEnvironment/GHC.Integer.symbols diff --git a/libraries/base-4.7.0.0/GHC/List.names b/data/baseEnvironment/GHC.List.symbols similarity index 100% rename from libraries/base-4.7.0.0/GHC/List.names rename to data/baseEnvironment/GHC.List.symbols diff --git a/libraries/base-4.7.0.0/GHC/MVar.names b/data/baseEnvironment/GHC.MVar.symbols similarity index 100% rename from libraries/base-4.7.0.0/GHC/MVar.names rename to data/baseEnvironment/GHC.MVar.symbols diff --git a/libraries/ghc-prim-0.3.1.0/GHC/Magic.names b/data/baseEnvironment/GHC.Magic.symbols similarity index 100% rename from libraries/ghc-prim-0.3.1.0/GHC/Magic.names rename to data/baseEnvironment/GHC.Magic.symbols diff --git a/libraries/base-4.7.0.0/GHC/Num.names b/data/baseEnvironment/GHC.Num.symbols similarity index 100% rename from libraries/base-4.7.0.0/GHC/Num.names rename to data/baseEnvironment/GHC.Num.symbols diff --git a/libraries/base-4.7.0.0/GHC/TypeLits.names b/data/baseEnvironment/GHC.PArr.symbols similarity index 100% rename from libraries/base-4.7.0.0/GHC/TypeLits.names rename to data/baseEnvironment/GHC.PArr.symbols diff --git a/libraries/base-4.7.0.0/GHC/Pack.names b/data/baseEnvironment/GHC.Pack.symbols similarity index 100% rename from libraries/base-4.7.0.0/GHC/Pack.names rename to data/baseEnvironment/GHC.Pack.symbols diff --git a/libraries/ghc-prim-0.3.1.0/GHC/Prim.names b/data/baseEnvironment/GHC.Prim.symbols similarity index 100% rename from libraries/ghc-prim-0.3.1.0/GHC/Prim.names rename to data/baseEnvironment/GHC.Prim.symbols diff --git a/libraries/ghc-prim-0.3.1.0/GHC/PrimopWrappers.names b/data/baseEnvironment/GHC.PrimopWrappers.symbols similarity index 100% rename from libraries/ghc-prim-0.3.1.0/GHC/PrimopWrappers.names rename to data/baseEnvironment/GHC.PrimopWrappers.symbols diff --git a/libraries/base-4.7.0.0/GHC/Profiling.names b/data/baseEnvironment/GHC.Profiling.symbols similarity index 100% rename from libraries/base-4.7.0.0/GHC/Profiling.names rename to data/baseEnvironment/GHC.Profiling.symbols diff --git a/libraries/base-4.7.0.0/GHC/Ptr.names b/data/baseEnvironment/GHC.Ptr.symbols similarity index 100% rename from libraries/base-4.7.0.0/GHC/Ptr.names rename to data/baseEnvironment/GHC.Ptr.symbols diff --git a/libraries/base-4.7.0.0/GHC/Read.names b/data/baseEnvironment/GHC.Read.symbols similarity index 100% rename from libraries/base-4.7.0.0/GHC/Read.names rename to data/baseEnvironment/GHC.Read.symbols diff --git a/libraries/base-4.7.0.0/GHC/Real.names b/data/baseEnvironment/GHC.Real.symbols similarity index 100% rename from libraries/base-4.7.0.0/GHC/Real.names rename to data/baseEnvironment/GHC.Real.symbols diff --git a/libraries/base-4.7.0.0/GHC/ST.names b/data/baseEnvironment/GHC.ST.symbols similarity index 100% rename from libraries/base-4.7.0.0/GHC/ST.names rename to data/baseEnvironment/GHC.ST.symbols diff --git a/libraries/base-4.7.0.0/GHC/STRef.names b/data/baseEnvironment/GHC.STRef.symbols similarity index 100% rename from libraries/base-4.7.0.0/GHC/STRef.names rename to data/baseEnvironment/GHC.STRef.symbols diff --git a/libraries/base-4.7.0.0/GHC/Show.names b/data/baseEnvironment/GHC.Show.symbols similarity index 100% rename from libraries/base-4.7.0.0/GHC/Show.names rename to data/baseEnvironment/GHC.Show.symbols diff --git a/libraries/base-4.7.0.0/GHC/Stable.names b/data/baseEnvironment/GHC.Stable.symbols similarity index 100% rename from libraries/base-4.7.0.0/GHC/Stable.names rename to data/baseEnvironment/GHC.Stable.symbols diff --git a/libraries/base-4.7.0.0/GHC/Stack.names b/data/baseEnvironment/GHC.Stack.symbols similarity index 100% rename from libraries/base-4.7.0.0/GHC/Stack.names rename to data/baseEnvironment/GHC.Stack.symbols diff --git a/libraries/base-4.7.0.0/GHC/Stats.names b/data/baseEnvironment/GHC.Stats.symbols similarity index 100% rename from libraries/base-4.7.0.0/GHC/Stats.names rename to data/baseEnvironment/GHC.Stats.symbols diff --git a/libraries/base-4.7.0.0/GHC/Storable.names b/data/baseEnvironment/GHC.Storable.symbols similarity index 100% rename from libraries/base-4.7.0.0/GHC/Storable.names rename to data/baseEnvironment/GHC.Storable.symbols diff --git a/libraries/base-4.7.0.0/GHC/TopHandler.names b/data/baseEnvironment/GHC.TopHandler.symbols similarity index 100% rename from libraries/base-4.7.0.0/GHC/TopHandler.names rename to data/baseEnvironment/GHC.TopHandler.symbols diff --git a/libraries/base-4.7.0.0/Text/Show/Functions.names b/data/baseEnvironment/GHC.Tuple.symbols similarity index 100% rename from libraries/base-4.7.0.0/Text/Show/Functions.names rename to data/baseEnvironment/GHC.Tuple.symbols diff --git a/libraries/ghc-prim-0.3.1.0/GHC/IntWord64.names b/data/baseEnvironment/GHC.TypeLits.symbols similarity index 100% rename from libraries/ghc-prim-0.3.1.0/GHC/IntWord64.names rename to data/baseEnvironment/GHC.TypeLits.symbols diff --git a/libraries/ghc-prim-0.3.1.0/GHC/Types.names b/data/baseEnvironment/GHC.Types.symbols similarity index 100% rename from libraries/ghc-prim-0.3.1.0/GHC/Types.names rename to data/baseEnvironment/GHC.Types.symbols diff --git a/libraries/base-4.7.0.0/GHC/Unicode.names b/data/baseEnvironment/GHC.Unicode.symbols similarity index 100% rename from libraries/base-4.7.0.0/GHC/Unicode.names rename to data/baseEnvironment/GHC.Unicode.symbols diff --git a/libraries/base-4.7.0.0/GHC/Weak.names b/data/baseEnvironment/GHC.Weak.symbols similarity index 100% rename from libraries/base-4.7.0.0/GHC/Weak.names rename to data/baseEnvironment/GHC.Weak.symbols diff --git a/libraries/base-4.7.0.0/GHC/Word.names b/data/baseEnvironment/GHC.Word.symbols similarity index 100% rename from libraries/base-4.7.0.0/GHC/Word.names rename to data/baseEnvironment/GHC.Word.symbols diff --git a/libraries/base-4.7.0.0/Numeric.names b/data/baseEnvironment/Numeric.symbols similarity index 100% rename from libraries/base-4.7.0.0/Numeric.names rename to data/baseEnvironment/Numeric.symbols diff --git a/libraries/base-4.7.0.0/Prelude.names b/data/baseEnvironment/Prelude.symbols similarity index 100% rename from libraries/base-4.7.0.0/Prelude.names rename to data/baseEnvironment/Prelude.symbols diff --git a/libraries/base-4.7.0.0/System/CPUTime.names b/data/baseEnvironment/System.CPUTime.symbols similarity index 100% rename from libraries/base-4.7.0.0/System/CPUTime.names rename to data/baseEnvironment/System.CPUTime.symbols diff --git a/libraries/base-4.7.0.0/System/Console/GetOpt.names b/data/baseEnvironment/System.Console.GetOpt.symbols similarity index 100% rename from libraries/base-4.7.0.0/System/Console/GetOpt.names rename to data/baseEnvironment/System.Console.GetOpt.symbols diff --git a/libraries/base-4.7.0.0/System/Environment/ExecutablePath.names b/data/baseEnvironment/System.Environment.ExecutablePath.symbols similarity index 100% rename from libraries/base-4.7.0.0/System/Environment/ExecutablePath.names rename to data/baseEnvironment/System.Environment.ExecutablePath.symbols diff --git a/libraries/base-4.7.0.0/System/Environment.names b/data/baseEnvironment/System.Environment.symbols similarity index 100% rename from libraries/base-4.7.0.0/System/Environment.names rename to data/baseEnvironment/System.Environment.symbols diff --git a/libraries/base-4.7.0.0/System/Exit.names b/data/baseEnvironment/System.Exit.symbols similarity index 100% rename from libraries/base-4.7.0.0/System/Exit.names rename to data/baseEnvironment/System.Exit.symbols diff --git a/libraries/base-4.7.0.0/System/IO/Error.names b/data/baseEnvironment/System.IO.Error.symbols similarity index 100% rename from libraries/base-4.7.0.0/System/IO/Error.names rename to data/baseEnvironment/System.IO.Error.symbols diff --git a/libraries/base-4.7.0.0/System/IO/Unsafe.names b/data/baseEnvironment/System.IO.Unsafe.symbols similarity index 100% rename from libraries/base-4.7.0.0/System/IO/Unsafe.names rename to data/baseEnvironment/System.IO.Unsafe.symbols diff --git a/libraries/base-4.7.0.0/System/IO.names b/data/baseEnvironment/System.IO.symbols similarity index 100% rename from libraries/base-4.7.0.0/System/IO.names rename to data/baseEnvironment/System.IO.symbols diff --git a/libraries/base-4.7.0.0/System/Info.names b/data/baseEnvironment/System.Info.symbols similarity index 100% rename from libraries/base-4.7.0.0/System/Info.names rename to data/baseEnvironment/System.Info.symbols diff --git a/libraries/base-4.7.0.0/System/Mem/StableName.names b/data/baseEnvironment/System.Mem.StableName.symbols similarity index 100% rename from libraries/base-4.7.0.0/System/Mem/StableName.names rename to data/baseEnvironment/System.Mem.StableName.symbols diff --git a/libraries/base-4.7.0.0/System/Mem/Weak.names b/data/baseEnvironment/System.Mem.Weak.symbols similarity index 100% rename from libraries/base-4.7.0.0/System/Mem/Weak.names rename to data/baseEnvironment/System.Mem.Weak.symbols diff --git a/libraries/base-4.7.0.0/System/Mem.names b/data/baseEnvironment/System.Mem.symbols similarity index 100% rename from libraries/base-4.7.0.0/System/Mem.names rename to data/baseEnvironment/System.Mem.symbols diff --git a/libraries/base-4.7.0.0/System/Posix/Internals.names b/data/baseEnvironment/System.Posix.Internals.symbols similarity index 100% rename from libraries/base-4.7.0.0/System/Posix/Internals.names rename to data/baseEnvironment/System.Posix.Internals.symbols diff --git a/libraries/base-4.7.0.0/System/Posix/Types.names b/data/baseEnvironment/System.Posix.Types.symbols similarity index 100% rename from libraries/base-4.7.0.0/System/Posix/Types.names rename to data/baseEnvironment/System.Posix.Types.symbols diff --git a/libraries/base-4.7.0.0/System/Timeout.names b/data/baseEnvironment/System.Timeout.symbols similarity index 100% rename from libraries/base-4.7.0.0/System/Timeout.names rename to data/baseEnvironment/System.Timeout.symbols diff --git a/libraries/base-4.7.0.0/Text/ParserCombinators/ReadP.names b/data/baseEnvironment/Text.ParserCombinators.ReadP.symbols similarity index 100% rename from libraries/base-4.7.0.0/Text/ParserCombinators/ReadP.names rename to data/baseEnvironment/Text.ParserCombinators.ReadP.symbols diff --git a/libraries/base-4.7.0.0/Text/ParserCombinators/ReadPrec.names b/data/baseEnvironment/Text.ParserCombinators.ReadPrec.symbols similarity index 100% rename from libraries/base-4.7.0.0/Text/ParserCombinators/ReadPrec.names rename to data/baseEnvironment/Text.ParserCombinators.ReadPrec.symbols diff --git a/libraries/base-4.7.0.0/Text/Printf.names b/data/baseEnvironment/Text.Printf.symbols similarity index 100% rename from libraries/base-4.7.0.0/Text/Printf.names rename to data/baseEnvironment/Text.Printf.symbols diff --git a/libraries/base-4.7.0.0/Text/Read/Lex.names b/data/baseEnvironment/Text.Read.Lex.symbols similarity index 100% rename from libraries/base-4.7.0.0/Text/Read/Lex.names rename to data/baseEnvironment/Text.Read.Lex.symbols diff --git a/libraries/base-4.7.0.0/Text/Read.names b/data/baseEnvironment/Text.Read.symbols similarity index 100% rename from libraries/base-4.7.0.0/Text/Read.names rename to data/baseEnvironment/Text.Read.symbols diff --git a/libraries/ghc-prim-0.3.1.0/GHC/Tuple.names b/data/baseEnvironment/Text.Show.Functions.symbols similarity index 100% rename from libraries/ghc-prim-0.3.1.0/GHC/Tuple.names rename to data/baseEnvironment/Text.Show.Functions.symbols diff --git a/libraries/base-4.7.0.0/Text/Show.names b/data/baseEnvironment/Text.Show.symbols similarity index 100% rename from libraries/base-4.7.0.0/Text/Show.names rename to data/baseEnvironment/Text.Show.symbols diff --git a/libraries/base-4.7.0.0/Unsafe/Coerce.names b/data/baseEnvironment/Unsafe.Coerce.symbols similarity index 100% rename from libraries/base-4.7.0.0/Unsafe/Coerce.names rename to data/baseEnvironment/Unsafe.Coerce.symbols diff --git a/examples/HeadUsages.hs b/examples/HeadUsages.hs index 006fa4d..585c7c5 100644 --- a/examples/HeadUsages.hs +++ b/examples/HeadUsages.hs @@ -1,19 +1,25 @@ module Main where -import Language.Haskell.Exts.Annotated -import qualified Language.Haskell.Exts as UnAnn (Name(Ident)) -import Language.Haskell.Names -import Language.Haskell.Names.Interfaces -import Distribution.HaskellSuite -import Distribution.Simple.Compiler +import Language.Haskell.Exts.Annotated ( + fromParseResult, parseModuleWithMode, defaultParseMode, + parseFilename, prettyPrint, srcInfoSpan) +import Language.Haskell.Exts ( + Name(Ident), ModuleName(ModuleName)) +import Language.Haskell.Names ( + loadBase, annotate, symbolName, + Scoped(Scoped), NameInfo(GlobalSymbol)) -import Data.Maybe -import Data.List -import Data.Proxy -import qualified Data.Foldable as Foldable -import Text.Printf -import Control.Applicative -import Control.Monad +import qualified Data.Map as Map ( + lookup) + +import Data.Maybe ( + fromMaybe, listToMaybe) +import Data.List ( + nub) +import qualified Data.Foldable as Foldable ( + toList) +import Control.Monad ( + forM_, guard) main :: IO () main = do @@ -21,57 +27,39 @@ main = do -- read the program's source from stdin source <- getContents - let - -- parse the program (using haskell-src-exts) - ast = fromParseResult $ - parseModuleWithMode defaultParseMode {parseFilename="stdin"} source - - -- get all installed packages (user and global) - pkgs <- - (++) <$> - getInstalledPackages (Proxy :: Proxy NamesDB) UserPackageDB <*> - getInstalledPackages (Proxy :: Proxy NamesDB) GlobalPackageDB - - headUsages <- evalNamesModuleT (findHeads ast) pkgs + -- parse the program (using haskell-src-exts) + let ast = fromParseResult ( + parseModuleWithMode defaultParseMode {parseFilename="stdin"} source) - forM_ headUsages $ \loc -> - printf "Prelude.head is used at %s\n" (prettyPrint $ srcInfoSpan loc) + -- get base environment + baseEnvironment <- loadBase - when (null headUsages) $ - printf "Congratulations! Your code doesn't use Prelude.head\n" + -- get symbols defined in prelude + let preludeSymbols = fromMaybe (error "Prelude not found") ( + Map.lookup (ModuleName "Prelude") baseEnvironment) --- this is a computation in a ModuleT monad, because we need access to --- modules' interfaces -findHeads :: Module SrcSpanInfo -> ModuleT [Symbol] IO [SrcSpanInfo] -findHeads ast = do - -- first of all, figure out the canonical name of "Prelude.head" - -- (hint: it's "GHC.List.head") - symbols <- fromMaybe (error "Prelude not found") <$> getModuleInfo "Prelude" - let - -- we walk through all values defined in Prelude and look for - -- one with name "head" - headSymbol = - fromMaybe (error "Prelude.head not found") (listToMaybe (do - symbol <- symbols - guard (symbolName symbol == UnAnn.Ident "head") - return symbol)) + -- find a Prelude symbol with name 'head' using the List monad + let headSymbol = fromMaybe (error "Prelude.head not found") ( + listToMaybe (do + preludeSymbol <- preludeSymbols + guard (symbolName preludeSymbol == Ident "head") + return preludeSymbol)) - -- annotate our ast with name binding information - annotatedAst <- - annotateModule - Haskell2010 -- base language - [] -- set of extensions - ast + -- annotate the AST + let annotatedAST = annotate baseEnvironment ast + -- get all annotations + let annotations = Foldable.toList annotatedAST - let - -- get list of all annotations - annotations = Foldable.toList annotatedAst + -- filter head Usages in List monad and remove duplicates + let headUsages = nub (do + Scoped (GlobalSymbol globalSymbol _) location <- annotations + guard (globalSymbol == headSymbol) + return location) - -- look for headSymbol - headUsages = nub (do - Scoped (GlobalSymbol globalSymbol _) location <- annotations - guard (globalSymbol == headSymbol) - return location) + case headUsages of + [] -> + putStrLn "Congratulations! Your code doesn't use Prelude.head" + _ -> forM_ headUsages (\location -> + putStrLn ("Prelude.head is used at " ++ (prettyPrint (srcInfoSpan location)))) - return headUsages \ No newline at end of file diff --git a/haskell-names.cabal b/haskell-names.cabal index 4e4bc75..74b05a0 100644 --- a/haskell-names.cabal +++ b/haskell-names.cabal @@ -1,13 +1,12 @@ Name: haskell-names -Version: 0.5.3 +Version: 0.6.0 License: BSD3 Author: Philipp Schuster, Roman Cheplyaka, Lennart Augustsson Maintainer: Philipp Schuster Category: Language Synopsis: Name resolution library for Haskell Description: - For a high-level overview of this package, - see + This package takes modules parsed with `haskell-src-exts`, resolves used names and annotates the parsed module with scoping information. Homepage: http://documentup.com/haskell-suite/haskell-names Stability: Experimental Build-Type: Simple @@ -23,231 +22,209 @@ extra-source-files: tests/exports/*.hs.golden tests/exports/*.hs data-files: - libraries/ghc-prim-0.3.1.0/GHC/Debug.names - libraries/ghc-prim-0.3.1.0/GHC/Types.names - libraries/ghc-prim-0.3.1.0/GHC/Classes.names - libraries/ghc-prim-0.3.1.0/GHC/IntWord64.names - libraries/ghc-prim-0.3.1.0/GHC/PrimopWrappers.names - libraries/ghc-prim-0.3.1.0/GHC/Prim.names - libraries/ghc-prim-0.3.1.0/GHC/Magic.names - libraries/ghc-prim-0.3.1.0/GHC/CString.names - libraries/ghc-prim-0.3.1.0/GHC/Tuple.names - libraries/integer-simple-0.1.1.0/GHC/Integer.names - libraries/integer-simple-0.1.1.0/GHC/Integer/Logarithms.names - libraries/integer-simple-0.1.1.0/GHC/Integer/Logarithms/Internals.names - libraries/integer-simple-0.1.1.0/GHC/Integer/Simple/Internals.names - libraries/integer-simple-0.1.1.0/GHC/Integer/Type.names - libraries/array-0.4.0.2/Data/Array/IO.names - libraries/array-0.4.0.2/Data/Array/Unboxed.names - libraries/array-0.4.0.2/Data/Array/Unsafe.names - libraries/array-0.4.0.2/Data/Array/ST.names - libraries/array-0.4.0.2/Data/Array/IO/Safe.names - libraries/array-0.4.0.2/Data/Array/IO/Internals.names - libraries/array-0.4.0.2/Data/Array/Base.names - libraries/array-0.4.0.2/Data/Array/MArray/Safe.names - libraries/array-0.4.0.2/Data/Array/ST/Safe.names - libraries/array-0.4.0.2/Data/Array/IArray.names - libraries/array-0.4.0.2/Data/Array/Storable/Safe.names - libraries/array-0.4.0.2/Data/Array/Storable/Internals.names - libraries/array-0.4.0.2/Data/Array/Storable.names - libraries/array-0.4.0.2/Data/Array/MArray.names - libraries/array-0.4.0.2/Data/Array.names - libraries/packages.db - libraries/base-4.7.0.0/Numeric.names - libraries/base-4.7.0.0/Prelude.names - libraries/base-4.7.0.0/System/Exit.names - libraries/base-4.7.0.0/System/Timeout.names - libraries/base-4.7.0.0/System/Mem.names - libraries/base-4.7.0.0/System/IO.names - libraries/base-4.7.0.0/System/Environment/ExecutablePath.names - libraries/base-4.7.0.0/System/Environment.names - libraries/base-4.7.0.0/System/Info.names - libraries/base-4.7.0.0/System/Mem/StableName.names - libraries/base-4.7.0.0/System/Mem/Weak.names - libraries/base-4.7.0.0/System/Console/GetOpt.names - libraries/base-4.7.0.0/System/CPUTime.names - libraries/base-4.7.0.0/System/IO/Unsafe.names - libraries/base-4.7.0.0/System/IO/Error.names - libraries/base-4.7.0.0/System/Posix/Internals.names - libraries/base-4.7.0.0/System/Posix/Types.names - libraries/base-4.7.0.0/include/consUtils.h - libraries/base-4.7.0.0/include/EventConfig.h - libraries/base-4.7.0.0/include/WCsubst.h - libraries/base-4.7.0.0/include/Typeable.h - libraries/base-4.7.0.0/include/HsBaseConfig.h - libraries/base-4.7.0.0/include/HsBase.h - libraries/base-4.7.0.0/include/OldTypeable.h - libraries/base-4.7.0.0/Foreign.names - libraries/base-4.7.0.0/Text/Read.names - libraries/base-4.7.0.0/Text/Printf.names - libraries/base-4.7.0.0/Text/Show.names - libraries/base-4.7.0.0/Text/ParserCombinators/ReadPrec.names - libraries/base-4.7.0.0/Text/ParserCombinators/ReadP.names - libraries/base-4.7.0.0/Text/Show/Functions.names - libraries/base-4.7.0.0/Text/Read/Lex.names - libraries/base-4.7.0.0/Control/Concurrent/MVar.names - libraries/base-4.7.0.0/Control/Concurrent/QSemN.names - libraries/base-4.7.0.0/Control/Concurrent/Chan.names - libraries/base-4.7.0.0/Control/Concurrent/QSem.names - libraries/base-4.7.0.0/Control/Exception/Base.names - libraries/base-4.7.0.0/Control/Exception.names - libraries/base-4.7.0.0/Control/Applicative.names - libraries/base-4.7.0.0/Control/Concurrent.names - libraries/base-4.7.0.0/Control/Category.names - libraries/base-4.7.0.0/Control/Monad.names - libraries/base-4.7.0.0/Control/Monad/Instances.names - libraries/base-4.7.0.0/Control/Monad/ST.names - libraries/base-4.7.0.0/Control/Monad/ST/Safe.names - libraries/base-4.7.0.0/Control/Monad/ST/Lazy/Safe.names - libraries/base-4.7.0.0/Control/Monad/ST/Lazy/Imp.names - libraries/base-4.7.0.0/Control/Monad/ST/Lazy/Unsafe.names - libraries/base-4.7.0.0/Control/Monad/ST/Lazy.names - libraries/base-4.7.0.0/Control/Monad/ST/Imp.names - libraries/base-4.7.0.0/Control/Monad/ST/Unsafe.names - libraries/base-4.7.0.0/Control/Monad/ST/Strict.names - libraries/base-4.7.0.0/Control/Monad/Zip.names - libraries/base-4.7.0.0/Control/Monad/Fix.names - libraries/base-4.7.0.0/Control/Arrow.names - libraries/base-4.7.0.0/Data/String.names - libraries/base-4.7.0.0/Data/Data.names - libraries/base-4.7.0.0/Data/Maybe.names - libraries/base-4.7.0.0/Data/OldTypeable/Internal.names - libraries/base-4.7.0.0/Data/Bits.names - libraries/base-4.7.0.0/Data/STRef/Lazy.names - libraries/base-4.7.0.0/Data/STRef/Strict.names - libraries/base-4.7.0.0/Data/Fixed.names - libraries/base-4.7.0.0/Data/Word.names - libraries/base-4.7.0.0/Data/Bool.names - libraries/base-4.7.0.0/Data/Int.names - libraries/base-4.7.0.0/Data/List.names - libraries/base-4.7.0.0/Data/Eq.names - libraries/base-4.7.0.0/Data/Traversable.names - libraries/base-4.7.0.0/Data/Char.names - libraries/base-4.7.0.0/Data/Either.names - libraries/base-4.7.0.0/Data/Dynamic.names - libraries/base-4.7.0.0/Data/Unique.names - libraries/base-4.7.0.0/Data/Function.names - libraries/base-4.7.0.0/Data/STRef.names - libraries/base-4.7.0.0/Data/Ratio.names - libraries/base-4.7.0.0/Data/Ord.names - libraries/base-4.7.0.0/Data/Foldable.names - libraries/base-4.7.0.0/Data/Functor.names - libraries/base-4.7.0.0/Data/Typeable/Internal.names - libraries/base-4.7.0.0/Data/Ix.names - libraries/base-4.7.0.0/Data/OldTypeable.names - libraries/base-4.7.0.0/Data/Version.names - libraries/base-4.7.0.0/Data/Complex.names - libraries/base-4.7.0.0/Data/IORef.names - libraries/base-4.7.0.0/Data/Tuple.names - libraries/base-4.7.0.0/Data/Monoid.names - libraries/base-4.7.0.0/Data/Typeable.names - libraries/base-4.7.0.0/GHC/Float/RealFracMethods.names - libraries/base-4.7.0.0/GHC/Float/ConversionUtils.names - libraries/base-4.7.0.0/GHC/Generics.names - libraries/base-4.7.0.0/GHC/Conc/IO.names - libraries/base-4.7.0.0/GHC/Conc/Sync.names - libraries/base-4.7.0.0/GHC/Conc/Signal.names - libraries/base-4.7.0.0/GHC/IO.names - libraries/base-4.7.0.0/GHC/Read.names - libraries/base-4.7.0.0/GHC/Event/PSQ.names - libraries/base-4.7.0.0/GHC/Event/Manager.names - libraries/base-4.7.0.0/GHC/Event/KQueue.names - libraries/base-4.7.0.0/GHC/Event/IntMap.names - libraries/base-4.7.0.0/GHC/Event/Unique.names - libraries/base-4.7.0.0/GHC/Event/Poll.names - libraries/base-4.7.0.0/GHC/Event/Control.names - libraries/base-4.7.0.0/GHC/Event/Array.names - libraries/base-4.7.0.0/GHC/Event/Clock.names - libraries/base-4.7.0.0/GHC/Event/EPoll.names - libraries/base-4.7.0.0/GHC/Event/Thread.names - libraries/base-4.7.0.0/GHC/Event/Internal.names - libraries/base-4.7.0.0/GHC/Event/TimerManager.names - libraries/base-4.7.0.0/GHC/Stable.names - libraries/base-4.7.0.0/GHC/Weak.names - libraries/base-4.7.0.0/GHC/Desugar.names - libraries/base-4.7.0.0/GHC/Arr.names - libraries/base-4.7.0.0/GHC/IP.names - libraries/base-4.7.0.0/GHC/MVar.names - libraries/base-4.7.0.0/GHC/Environment.names - libraries/base-4.7.0.0/GHC/ConsoleHandler.names - libraries/base-4.7.0.0/GHC/Enum.names - libraries/base-4.7.0.0/GHC/Word.names - libraries/base-4.7.0.0/GHC/Unicode.names - libraries/base-4.7.0.0/GHC/Real.names - libraries/base-4.7.0.0/GHC/Profiling.names - libraries/base-4.7.0.0/GHC/IOArray.names - libraries/base-4.7.0.0/GHC/Stats.names - libraries/base-4.7.0.0/GHC/Int.names - libraries/base-4.7.0.0/GHC/List.names - libraries/base-4.7.0.0/GHC/Show.names - libraries/base-4.7.0.0/GHC/Num.names - libraries/base-4.7.0.0/GHC/ST.names - libraries/base-4.7.0.0/GHC/TypeLits.names - libraries/base-4.7.0.0/GHC/Char.names - libraries/base-4.7.0.0/GHC/Pack.names - libraries/base-4.7.0.0/GHC/Exception.names - libraries/base-4.7.0.0/GHC/TopHandler.names - libraries/base-4.7.0.0/GHC/Foreign.names - libraries/base-4.7.0.0/GHC/STRef.names - libraries/base-4.7.0.0/GHC/IO/FD.names - libraries/base-4.7.0.0/GHC/IO/Exception.names - libraries/base-4.7.0.0/GHC/IO/Handle/Text.names - libraries/base-4.7.0.0/GHC/IO/Handle/Internals.names - libraries/base-4.7.0.0/GHC/IO/Handle/Types.names - libraries/base-4.7.0.0/GHC/IO/Handle/FD.names - libraries/base-4.7.0.0/GHC/IO/Encoding/CodePage.names - libraries/base-4.7.0.0/GHC/IO/Encoding/Failure.names - libraries/base-4.7.0.0/GHC/IO/Encoding/UTF32.names - libraries/base-4.7.0.0/GHC/IO/Encoding/Types.names - libraries/base-4.7.0.0/GHC/IO/Encoding/UTF8.names - libraries/base-4.7.0.0/GHC/IO/Encoding/UTF16.names - libraries/base-4.7.0.0/GHC/IO/Encoding/Iconv.names - libraries/base-4.7.0.0/GHC/IO/Encoding/Latin1.names - libraries/base-4.7.0.0/GHC/IO/Device.names - libraries/base-4.7.0.0/GHC/IO/Encoding.names - libraries/base-4.7.0.0/GHC/IO/Handle.names - libraries/base-4.7.0.0/GHC/IO/IOMode.names - libraries/base-4.7.0.0/GHC/IO/Buffer.names - libraries/base-4.7.0.0/GHC/IO/BufferedIO.names - libraries/base-4.7.0.0/GHC/Err.names - libraries/base-4.7.0.0/GHC/Base.names - libraries/base-4.7.0.0/GHC/Stack.names - libraries/base-4.7.0.0/GHC/Conc.names - libraries/base-4.7.0.0/GHC/Fingerprint/Type.names - libraries/base-4.7.0.0/GHC/Fingerprint.names - libraries/base-4.7.0.0/GHC/ForeignPtr.names - libraries/base-4.7.0.0/GHC/Exts.names - libraries/base-4.7.0.0/GHC/Event.names - libraries/base-4.7.0.0/GHC/GHCi.names - libraries/base-4.7.0.0/GHC/Float.names - libraries/base-4.7.0.0/GHC/IORef.names - libraries/base-4.7.0.0/GHC/Storable.names - libraries/base-4.7.0.0/GHC/Constants.names - libraries/base-4.7.0.0/GHC/Ptr.names - libraries/base-4.7.0.0/GHC/PArr.names - libraries/base-4.7.0.0/Foreign/C.names - libraries/base-4.7.0.0/Foreign/Safe.names - libraries/base-4.7.0.0/Foreign/ForeignPtr/Safe.names - libraries/base-4.7.0.0/Foreign/ForeignPtr/Imp.names - libraries/base-4.7.0.0/Foreign/ForeignPtr/Unsafe.names - libraries/base-4.7.0.0/Foreign/Marshal/Safe.names - libraries/base-4.7.0.0/Foreign/Marshal/Alloc.names - libraries/base-4.7.0.0/Foreign/Marshal/Utils.names - libraries/base-4.7.0.0/Foreign/Marshal/Unsafe.names - libraries/base-4.7.0.0/Foreign/Marshal/Array.names - libraries/base-4.7.0.0/Foreign/Marshal/Error.names - libraries/base-4.7.0.0/Foreign/Marshal/Pool.names - libraries/base-4.7.0.0/Foreign/C/String.names - libraries/base-4.7.0.0/Foreign/C/Types.names - libraries/base-4.7.0.0/Foreign/C/Error.names - libraries/base-4.7.0.0/Foreign/StablePtr.names - libraries/base-4.7.0.0/Foreign/Concurrent.names - libraries/base-4.7.0.0/Foreign/ForeignPtr.names - libraries/base-4.7.0.0/Foreign/Marshal.names - libraries/base-4.7.0.0/Foreign/Storable.names - libraries/base-4.7.0.0/Foreign/Ptr.names - libraries/base-4.7.0.0/Debug/Trace.names - libraries/base-4.7.0.0/Unsafe/Coerce.names + data/baseEnvironment/Control.Applicative.symbols + data/baseEnvironment/Control.Arrow.symbols + data/baseEnvironment/Control.Category.symbols + data/baseEnvironment/Control.Concurrent.Chan.symbols + data/baseEnvironment/Control.Concurrent.MVar.symbols + data/baseEnvironment/Control.Concurrent.QSem.symbols + data/baseEnvironment/Control.Concurrent.QSemN.symbols + data/baseEnvironment/Control.Concurrent.symbols + data/baseEnvironment/Control.Exception.Base.symbols + data/baseEnvironment/Control.Exception.symbols + data/baseEnvironment/Control.Monad.Fix.symbols + data/baseEnvironment/Control.Monad.Instances.symbols + data/baseEnvironment/Control.Monad.ST.Imp.symbols + data/baseEnvironment/Control.Monad.ST.Lazy.Imp.symbols + data/baseEnvironment/Control.Monad.ST.Lazy.Safe.symbols + data/baseEnvironment/Control.Monad.ST.Lazy.Unsafe.symbols + data/baseEnvironment/Control.Monad.ST.Lazy.symbols + data/baseEnvironment/Control.Monad.ST.Safe.symbols + data/baseEnvironment/Control.Monad.ST.Strict.symbols + data/baseEnvironment/Control.Monad.ST.Unsafe.symbols + data/baseEnvironment/Control.Monad.ST.symbols + data/baseEnvironment/Control.Monad.Zip.symbols + data/baseEnvironment/Control.Monad.symbols + data/baseEnvironment/Data.Bits.symbols + data/baseEnvironment/Data.Bool.symbols + data/baseEnvironment/Data.Char.symbols + data/baseEnvironment/Data.Complex.symbols + data/baseEnvironment/Data.Data.symbols + data/baseEnvironment/Data.Dynamic.symbols + data/baseEnvironment/Data.Either.symbols + data/baseEnvironment/Data.Eq.symbols + data/baseEnvironment/Data.Fixed.symbols + data/baseEnvironment/Data.Foldable.symbols + data/baseEnvironment/Data.Function.symbols + data/baseEnvironment/Data.Functor.symbols + data/baseEnvironment/Data.IORef.symbols + data/baseEnvironment/Data.Int.symbols + data/baseEnvironment/Data.Ix.symbols + data/baseEnvironment/Data.List.symbols + data/baseEnvironment/Data.Maybe.symbols + data/baseEnvironment/Data.Monoid.symbols + data/baseEnvironment/Data.OldTypeable.Internal.symbols + data/baseEnvironment/Data.OldTypeable.symbols + data/baseEnvironment/Data.Ord.symbols + data/baseEnvironment/Data.Ratio.symbols + data/baseEnvironment/Data.STRef.Lazy.symbols + data/baseEnvironment/Data.STRef.Strict.symbols + data/baseEnvironment/Data.STRef.symbols + data/baseEnvironment/Data.String.symbols + data/baseEnvironment/Data.Traversable.symbols + data/baseEnvironment/Data.Tuple.symbols + data/baseEnvironment/Data.Typeable.Internal.symbols + data/baseEnvironment/Data.Typeable.symbols + data/baseEnvironment/Data.Unique.symbols + data/baseEnvironment/Data.Version.symbols + data/baseEnvironment/Data.Word.symbols + data/baseEnvironment/Debug.Trace.symbols + data/baseEnvironment/Foreign.C.Error.symbols + data/baseEnvironment/Foreign.C.String.symbols + data/baseEnvironment/Foreign.C.Types.symbols + data/baseEnvironment/Foreign.C.symbols + data/baseEnvironment/Foreign.Concurrent.symbols + data/baseEnvironment/Foreign.ForeignPtr.Imp.symbols + data/baseEnvironment/Foreign.ForeignPtr.Safe.symbols + data/baseEnvironment/Foreign.ForeignPtr.Unsafe.symbols + data/baseEnvironment/Foreign.ForeignPtr.symbols + data/baseEnvironment/Foreign.Marshal.Alloc.symbols + data/baseEnvironment/Foreign.Marshal.Array.symbols + data/baseEnvironment/Foreign.Marshal.Error.symbols + data/baseEnvironment/Foreign.Marshal.Pool.symbols + data/baseEnvironment/Foreign.Marshal.Safe.symbols + data/baseEnvironment/Foreign.Marshal.Unsafe.symbols + data/baseEnvironment/Foreign.Marshal.Utils.symbols + data/baseEnvironment/Foreign.Marshal.symbols + data/baseEnvironment/Foreign.Ptr.symbols + data/baseEnvironment/Foreign.Safe.symbols + data/baseEnvironment/Foreign.StablePtr.symbols + data/baseEnvironment/Foreign.Storable.symbols + data/baseEnvironment/Foreign.symbols + data/baseEnvironment/GHC.Arr.symbols + data/baseEnvironment/GHC.Base.symbols + data/baseEnvironment/GHC.CString.symbols + data/baseEnvironment/GHC.Char.symbols + data/baseEnvironment/GHC.Classes.symbols + data/baseEnvironment/GHC.Conc.IO.symbols + data/baseEnvironment/GHC.Conc.Signal.symbols + data/baseEnvironment/GHC.Conc.Sync.symbols + data/baseEnvironment/GHC.Conc.symbols + data/baseEnvironment/GHC.ConsoleHandler.symbols + data/baseEnvironment/GHC.Constants.symbols + data/baseEnvironment/GHC.Debug.symbols + data/baseEnvironment/GHC.Desugar.symbols + data/baseEnvironment/GHC.Enum.symbols + data/baseEnvironment/GHC.Environment.symbols + data/baseEnvironment/GHC.Err.symbols + data/baseEnvironment/GHC.Event.Array.symbols + data/baseEnvironment/GHC.Event.Clock.symbols + data/baseEnvironment/GHC.Event.Control.symbols + data/baseEnvironment/GHC.Event.EPoll.symbols + data/baseEnvironment/GHC.Event.IntMap.symbols + data/baseEnvironment/GHC.Event.Internal.symbols + data/baseEnvironment/GHC.Event.KQueue.symbols + data/baseEnvironment/GHC.Event.Manager.symbols + data/baseEnvironment/GHC.Event.PSQ.symbols + data/baseEnvironment/GHC.Event.Poll.symbols + data/baseEnvironment/GHC.Event.Thread.symbols + data/baseEnvironment/GHC.Event.TimerManager.symbols + data/baseEnvironment/GHC.Event.Unique.symbols + data/baseEnvironment/GHC.Event.symbols + data/baseEnvironment/GHC.Exception.symbols + data/baseEnvironment/GHC.Exts.symbols + data/baseEnvironment/GHC.Fingerprint.Type.symbols + data/baseEnvironment/GHC.Fingerprint.symbols + data/baseEnvironment/GHC.Float.ConversionUtils.symbols + data/baseEnvironment/GHC.Float.RealFracMethods.symbols + data/baseEnvironment/GHC.Float.symbols + data/baseEnvironment/GHC.Foreign.symbols + data/baseEnvironment/GHC.ForeignPtr.symbols + data/baseEnvironment/GHC.GHCi.symbols + data/baseEnvironment/GHC.Generics.symbols + data/baseEnvironment/GHC.IO.Buffer.symbols + data/baseEnvironment/GHC.IO.BufferedIO.symbols + data/baseEnvironment/GHC.IO.Device.symbols + data/baseEnvironment/GHC.IO.Encoding.CodePage.symbols + data/baseEnvironment/GHC.IO.Encoding.Failure.symbols + data/baseEnvironment/GHC.IO.Encoding.Iconv.symbols + data/baseEnvironment/GHC.IO.Encoding.Latin1.symbols + data/baseEnvironment/GHC.IO.Encoding.Types.symbols + data/baseEnvironment/GHC.IO.Encoding.UTF16.symbols + data/baseEnvironment/GHC.IO.Encoding.UTF32.symbols + data/baseEnvironment/GHC.IO.Encoding.UTF8.symbols + data/baseEnvironment/GHC.IO.Encoding.symbols + data/baseEnvironment/GHC.IO.Exception.symbols + data/baseEnvironment/GHC.IO.FD.symbols + data/baseEnvironment/GHC.IO.Handle.FD.symbols + data/baseEnvironment/GHC.IO.Handle.Internals.symbols + data/baseEnvironment/GHC.IO.Handle.Text.symbols + data/baseEnvironment/GHC.IO.Handle.Types.symbols + data/baseEnvironment/GHC.IO.Handle.symbols + data/baseEnvironment/GHC.IO.IOMode.symbols + data/baseEnvironment/GHC.IO.symbols + data/baseEnvironment/GHC.IOArray.symbols + data/baseEnvironment/GHC.IORef.symbols + data/baseEnvironment/GHC.IP.symbols + data/baseEnvironment/GHC.Int.symbols + data/baseEnvironment/GHC.IntWord64.symbols + data/baseEnvironment/GHC.Integer.Logarithms.Internals.symbols + data/baseEnvironment/GHC.Integer.Logarithms.symbols + data/baseEnvironment/GHC.Integer.Simple.Internals.symbols + data/baseEnvironment/GHC.Integer.Type.symbols + data/baseEnvironment/GHC.Integer.symbols + data/baseEnvironment/GHC.List.symbols + data/baseEnvironment/GHC.MVar.symbols + data/baseEnvironment/GHC.Magic.symbols + data/baseEnvironment/GHC.Num.symbols + data/baseEnvironment/GHC.PArr.symbols + data/baseEnvironment/GHC.Pack.symbols + data/baseEnvironment/GHC.Prim.symbols + data/baseEnvironment/GHC.PrimopWrappers.symbols + data/baseEnvironment/GHC.Profiling.symbols + data/baseEnvironment/GHC.Ptr.symbols + data/baseEnvironment/GHC.Read.symbols + data/baseEnvironment/GHC.Real.symbols + data/baseEnvironment/GHC.ST.symbols + data/baseEnvironment/GHC.STRef.symbols + data/baseEnvironment/GHC.Show.symbols + data/baseEnvironment/GHC.Stable.symbols + data/baseEnvironment/GHC.Stack.symbols + data/baseEnvironment/GHC.Stats.symbols + data/baseEnvironment/GHC.Storable.symbols + data/baseEnvironment/GHC.TopHandler.symbols + data/baseEnvironment/GHC.Tuple.symbols + data/baseEnvironment/GHC.TypeLits.symbols + data/baseEnvironment/GHC.Types.symbols + data/baseEnvironment/GHC.Unicode.symbols + data/baseEnvironment/GHC.Weak.symbols + data/baseEnvironment/GHC.Word.symbols + data/baseEnvironment/Numeric.symbols + data/baseEnvironment/Prelude.symbols + data/baseEnvironment/System.CPUTime.symbols + data/baseEnvironment/System.Console.GetOpt.symbols + data/baseEnvironment/System.Environment.ExecutablePath.symbols + data/baseEnvironment/System.Environment.symbols + data/baseEnvironment/System.Exit.symbols + data/baseEnvironment/System.IO.Error.symbols + data/baseEnvironment/System.IO.Unsafe.symbols + data/baseEnvironment/System.IO.symbols + data/baseEnvironment/System.Info.symbols + data/baseEnvironment/System.Mem.StableName.symbols + data/baseEnvironment/System.Mem.Weak.symbols + data/baseEnvironment/System.Mem.symbols + data/baseEnvironment/System.Posix.Internals.symbols + data/baseEnvironment/System.Posix.Types.symbols + data/baseEnvironment/System.Timeout.symbols + data/baseEnvironment/Text.ParserCombinators.ReadP.symbols + data/baseEnvironment/Text.ParserCombinators.ReadPrec.symbols + data/baseEnvironment/Text.Printf.symbols + data/baseEnvironment/Text.Read.Lex.symbols + data/baseEnvironment/Text.Read.symbols + data/baseEnvironment/Text.Show.Functions.symbols + data/baseEnvironment/Text.Show.symbols + data/baseEnvironment/Unsafe.Coerce.symbols + source-repository head type: git @@ -257,28 +234,23 @@ Library Default-Language: Haskell2010 Build-depends: base >= 4 && < 5 - , haskell-src-exts >= 1.16 - , mtl - , transformers - , filepath >= 1.1 - , containers >= 0.2 - , hse-cpp - , uniplate >= 1.5.1 - , aeson - , bytestring - , haskell-packages >= 0.2 - , data-lens-light - , tagged - , traverse-with-class - , type-eq >= 0.4.2 - , Cabal >= 1.14 + , haskell-src-exts >= 1.17 && < 1.18 + , mtl >= 2.2.1 && < 2.3 + , transformers >=0.4.2.0 && < 0.5 + , filepath >= 1.1 && < 1.5 + , containers >= 0.2 && < 0.6 + , uniplate >= 1.5.1 && < 1.7 + , aeson >= 0.8.0.2 && < 0.11 + , bytestring >= 0.10.4.0 && < 0.11 + , data-lens-light >= 0.1.2.1 && < 0.2 + , traverse-with-class >= 0.2.0.3 && < 0.3 Hs-source-dirs: src Ghc-options: -Wall -fno-warn-name-shadowing Exposed-modules: Language.Haskell.Names Language.Haskell.Names.Open Language.Haskell.Names.Annotated - Language.Haskell.Names.Interfaces + Language.Haskell.Names.Environment Language.Haskell.Names.GlobalSymbolTable Language.Haskell.Names.LocalSymbolTable Language.Haskell.Names.Imports @@ -306,23 +278,14 @@ Test-suite test run.hs Build-depends: base >= 4 && < 5 - , haskell-src-exts >= 1.9 - , mtl - , filepath >= 1.1 - , containers >= 0.2 - , hse-cpp - , uniplate >= 1.5.1 - , aeson - , bytestring - , haskell-packages - , tasty - , tasty-golden >= 2.2.1 - , filemanip - , utf8-string - -- we have to fix the pretty-show version, because the change in the - -- output format may affect the tests success + , haskell-src-exts >= 1.17 && < 1.18 + , mtl >= 2.2.1 && < 2.3 + , filepath >= 1.1 && <1.5 + , containers >= 0.2 && < 0.6 + , tasty >= 0.10.1.2 && < 0.12 + , tasty-golden >= 2.2.1 && < 2.4 + , filemanip >= 0.3.6.3 && < 0.4 , pretty-show >= 1.6.1 && < 1.7 - , Cabal - , haskell-names - , tagged - , traverse-with-class + , traverse-with-class >= 0.2.0.3 && < 0.3 + , haskell-names >= 0.6.0 && < 0.7 + diff --git a/hs-gen-iface/.ghci b/hs-gen-iface/.ghci deleted file mode 100644 index 002379b..0000000 --- a/hs-gen-iface/.ghci +++ /dev/null @@ -1,2 +0,0 @@ -:set -isrc -idist/build/autogen -:set -Wall -fno-warn-name-shadowing diff --git a/hs-gen-iface/LICENSE b/hs-gen-iface/LICENSE deleted file mode 100644 index 1a7b420..0000000 --- a/hs-gen-iface/LICENSE +++ /dev/null @@ -1,19 +0,0 @@ -Copyright (c) 2012 Roman Cheplyaka - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. diff --git a/hs-gen-iface/Setup.hs b/hs-gen-iface/Setup.hs deleted file mode 100644 index 9a994af..0000000 --- a/hs-gen-iface/Setup.hs +++ /dev/null @@ -1,2 +0,0 @@ -import Distribution.Simple -main = defaultMain diff --git a/hs-gen-iface/hs-gen-iface.cabal b/hs-gen-iface/hs-gen-iface.cabal deleted file mode 100644 index 49eb9d8..0000000 --- a/hs-gen-iface/hs-gen-iface.cabal +++ /dev/null @@ -1,32 +0,0 @@ -Name: hs-gen-iface -Version: 0.5.3 -License: MIT -License-file: LICENSE -Author: Roman Cheplyaka -Maintainer: Roman Cheplyaka -Description: Compiler which generates module interfaces for haskell-names -Category: Language -Synopsis: Utility to generate haskell-names interface files -Stability: Experimental -Build-Type: Simple -Cabal-Version: >= 1.10 - -Executable hs-gen-iface - Default-Language: Haskell2010 - ghc-options: -Wall -fno-warn-name-shadowing - hs-source-dirs: src - Main-is: - hs-gen-iface.hs - Other-modules: - Paths_hs_gen_iface - Build-depends: - base == 4.*, - containers, - haskell-src-exts, - haskell-names, - haskell-packages, - filepath, - mtl, - Cabal, - hse-cpp, - tagged diff --git a/hs-gen-iface/src/hs-gen-iface.hs b/hs-gen-iface/src/hs-gen-iface.hs deleted file mode 100644 index 3a70487..0000000 --- a/hs-gen-iface/src/hs-gen-iface.hs +++ /dev/null @@ -1,104 +0,0 @@ -{-# LANGUAGE DeriveDataTypeable #-} -module Main where - -import qualified Language.Haskell.Exts.Annotated as HSE -import qualified Language.Haskell.Exts as UnAnn -import Language.Haskell.Exts (defaultParseMode, ParseMode(..)) -import Language.Haskell.Names -import Language.Haskell.Names.Interfaces -import Language.Haskell.Exts.Extension -import Language.Haskell.Exts.SrcLoc -import Control.Monad -import Control.Exception -import Data.Typeable -import Data.Proxy -import Data.Maybe -import qualified Data.Foldable as F -import System.FilePath -import Text.Printf - -import Distribution.HaskellSuite -import qualified Distribution.HaskellSuite.Compiler as Compiler - -import Distribution.ModuleName hiding (main) -import Distribution.Simple.Utils -import Distribution.Verbosity - -import Language.Haskell.Exts.Annotated.CPP -import Paths_hs_gen_iface -import Language.Haskell.Names.SyntaxUtils - -data GenIfaceException - = ParseError HSE.SrcLoc String - | ScopeErrors (Error HSE.SrcSpan) - deriving Typeable - -instance Show GenIfaceException where - show (ParseError (SrcLoc file line col) msg) = - printf "%s:%d:%d:\n %s" file line col msg - show ScopeErrors {} = "scope errors (show not implemented yet)" - -instance Exception GenIfaceException - -fromParseResult :: HSE.ParseResult a -> IO a -fromParseResult (HSE.ParseOk x) = return x -fromParseResult (HSE.ParseFailed loc msg) = throwIO $ ParseError loc msg - -main :: IO () -main = - Compiler.main theTool - -suffix :: String -suffix = "names" - -theTool :: Compiler.Simple NamesDB -theTool = - Compiler.simple - "haskell-names" - version - knownLanguages - knownExtensions - compile - [suffix] - -fixCppOpts :: CpphsOptions -> CpphsOptions -fixCppOpts opts = - opts { - defines = ("__GLASGOW_HASKELL__", "708") : defines opts -- FIXME - } - -parse :: Language -> [Extension] -> CpphsOptions -> FilePath -> IO (HSE.Module HSE.SrcSpan) -parse lang exts cppOpts file = do - x <- return . fmap HSE.srcInfoSpan . fst - =<< fromParseResult - =<< parseFileWithCommentsAndCPP (fixCppOpts cppOpts) mode file - return x - where - mode = defaultParseMode - { UnAnn.parseFilename = file - , baseLanguage = lang - , extensions = exts - , ignoreLanguagePragmas = False - , ignoreLinePragmas = False - } - -compile :: Compiler.CompileFn -compile buildDir mbLang exts cppOpts pkgName pkgdbs deps files = do - let lang = fromMaybe Haskell98 mbLang - - moduleSet <- mapM (parse lang exts cppOpts) files - - packages <- readPackagesInfo (Proxy :: Proxy NamesDB) pkgdbs deps - - (ifaces, errors) <- evalModuleT (getInterfaces lang exts moduleSet) packages "names" readInterface - - F.for_ errors $ \e -> printf "Warning: %s" (ppError e) - - forM_ (zip moduleSet ifaces) $ \(mod, syms) -> do - - let HSE.ModuleName _ modname = getModuleName mod - ifaceFile = buildDir toFilePath (fromString modname) <.> suffix - - createDirectoryIfMissingVerbose silent True (dropFileName ifaceFile) - - writeInterface ifaceFile syms diff --git a/hs-mk-global-db/LICENSE b/hs-mk-global-db/LICENSE deleted file mode 100644 index 136a074..0000000 --- a/hs-mk-global-db/LICENSE +++ /dev/null @@ -1,19 +0,0 @@ -Copyright (c) 2013 Roman Cheplyaka - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. diff --git a/hs-mk-global-db/Main.hs b/hs-mk-global-db/Main.hs deleted file mode 100644 index 6d50dba..0000000 --- a/hs-mk-global-db/Main.hs +++ /dev/null @@ -1,58 +0,0 @@ -import Language.Haskell.Names.Interfaces -import Options.Applicative -import Data.Monoid -import Data.Proxy -import qualified Data.Map as Map -import Control.Monad -import Distribution.HaskellSuite -import Distribution.Simple.Compiler -import Distribution.Package -import Distribution.InstalledPackageInfo -import Distribution.Text -import Distribution.Verbosity -import Distribution.Simple.Utils (installDirectoryContents) -import Text.Printf -import System.Exit -import System.FilePath -import System.Directory - -main = - join $ - execParser $ flip info mempty $ - genDb <$> - strOption (long "package-db") <*> - strOption (short 'o') - -pkgNames = map PackageName ["base", "ghc-prim", "integer-simple", "array"] - -genDb :: FilePath -> FilePath -> IO () -genDb pkgDb dest = do - pkgs <- getInstalledPackages (Proxy :: Proxy NamesDB) (SpecificPackageDB pkgDb) - - let - pkgMap :: Map.Map PackageName Packages - pkgMap = Map.fromListWith mappend - [ ((pkgName . sourcePackageId) pkg, [pkg]) | pkg <- pkgs ] - - mbPkgs :: Either PackageName Packages - mbPkgs = - fmap concat . forM pkgNames $ \pkgName -> - maybe (Left pkgName) Right $ Map.lookup pkgName pkgMap - - case mbPkgs of - Left pkg -> do - printf "Core package %s is not installed in the database %s\n" - (display pkg) - dest - exitFailure - - Right pkgs -> do - createDirectoryIfMissing True dest - pkgs' <- forM pkgs $ \pkg -> do - let newDir = display (installedPackageId pkg) - - installDirectoryContents normal (head $ libraryDirs pkg) (dest newDir) - - return $ pkg { libraryDirs = [newDir] } - - writeDB (dest "packages.db") pkgs' diff --git a/hs-mk-global-db/Setup.hs b/hs-mk-global-db/Setup.hs deleted file mode 100644 index 9a994af..0000000 --- a/hs-mk-global-db/Setup.hs +++ /dev/null @@ -1,2 +0,0 @@ -import Distribution.Simple -main = defaultMain diff --git a/hs-mk-global-db/hs-mk-global-db.cabal b/hs-mk-global-db/hs-mk-global-db.cabal deleted file mode 100644 index 73e3311..0000000 --- a/hs-mk-global-db/hs-mk-global-db.cabal +++ /dev/null @@ -1,33 +0,0 @@ --- Initial hs-mk-global-db.cabal generated by cabal init. For further --- documentation, see http://haskell.org/cabal/users-guide/ - -name: hs-mk-global-db -version: 0.1 -synopsis: Utility to generate a global haskell-names package db --- description: -license: MIT -license-file: LICENSE -author: Roman Cheplyaka -maintainer: roma@ro-che.info --- copyright: -category: Language -build-type: Simple --- extra-source-files: -cabal-version: >=1.10 - -executable hs-mk-global-db - main-is: Main.hs - -- other-modules: - -- other-extensions: - build-depends: - base, - filepath, - directory, - Cabal, - haskell-names, - haskell-packages, - containers, - tagged, - optparse-applicative - -- hs-source-dirs: - default-language: Haskell2010 diff --git a/libraries/array-0.4.0.2/Data/Array.names b/libraries/array-0.4.0.2/Data/Array.names deleted file mode 100644 index 98b33a2..0000000 --- a/libraries/array-0.4.0.2/Data/Array.names +++ /dev/null @@ -1 +0,0 @@ -[{"name":"inRange","module":"GHC.Arr","entity":"method","class":"Ix"},{"name":"index","module":"GHC.Arr","entity":"method","class":"Ix"},{"name":"range","module":"GHC.Arr","entity":"method","class":"Ix"},{"name":"rangeSize","module":"GHC.Arr","entity":"method","class":"Ix"},{"name":"Ix","module":"GHC.Arr","entity":"class"},{"name":"Array","module":"GHC.Arr","entity":"data"},{"name":"array","module":"GHC.Arr","entity":"value"},{"name":"listArray","module":"GHC.Arr","entity":"value"},{"name":"accumArray","module":"GHC.Arr","entity":"value"},{"name":"!","module":"GHC.Arr","entity":"value"},{"name":"bounds","module":"GHC.Arr","entity":"value"},{"name":"indices","module":"GHC.Arr","entity":"value"},{"name":"elems","module":"GHC.Arr","entity":"value"},{"name":"assocs","module":"GHC.Arr","entity":"value"},{"name":"//","module":"GHC.Arr","entity":"value"},{"name":"accum","module":"GHC.Arr","entity":"value"},{"name":"ixmap","module":"GHC.Arr","entity":"value"}] diff --git a/libraries/array-0.4.0.2/Data/Array/Base.names b/libraries/array-0.4.0.2/Data/Array/Base.names deleted file mode 100644 index 511f683..0000000 --- a/libraries/array-0.4.0.2/Data/Array/Base.names +++ /dev/null @@ -1 +0,0 @@ -[{"name":"IArray","module":"Data.Array.Base","entity":"class"},{"name":"bounds","module":"Data.Array.Base","entity":"method","class":"IArray"},{"name":"numElements","module":"Data.Array.Base","entity":"method","class":"IArray"},{"name":"unsafeArray","module":"Data.Array.Base","entity":"method","class":"IArray"},{"name":"unsafeAt","module":"Data.Array.Base","entity":"method","class":"IArray"},{"name":"unsafeReplace","module":"Data.Array.Base","entity":"method","class":"IArray"},{"name":"unsafeAccum","module":"Data.Array.Base","entity":"method","class":"IArray"},{"name":"unsafeAccumArray","module":"Data.Array.Base","entity":"method","class":"IArray"},{"name":"safeRangeSize","module":"Data.Array.Base","entity":"value"},{"name":"safeIndex","module":"Data.Array.Base","entity":"value"},{"name":"unsafeReplaceST","module":"Data.Array.Base","entity":"value"},{"name":"unsafeAccumST","module":"Data.Array.Base","entity":"value"},{"name":"unsafeAccumArrayST","module":"Data.Array.Base","entity":"value"},{"name":"array","module":"Data.Array.Base","entity":"value"},{"name":"listArray","module":"Data.Array.Base","entity":"value"},{"name":"listArrayST","module":"Data.Array.Base","entity":"value"},{"name":"listUArrayST","module":"Data.Array.Base","entity":"value"},{"name":"ListUArray","module":"Data.Array.Base","entity":"type"},{"name":"!","module":"Data.Array.Base","entity":"value"},{"name":"indices","module":"Data.Array.Base","entity":"value"},{"name":"elems","module":"Data.Array.Base","entity":"value"},{"name":"assocs","module":"Data.Array.Base","entity":"value"},{"name":"accumArray","module":"Data.Array.Base","entity":"value"},{"name":"//","module":"Data.Array.Base","entity":"value"},{"name":"accum","module":"Data.Array.Base","entity":"value"},{"name":"amap","module":"Data.Array.Base","entity":"value"},{"name":"ixmap","module":"Data.Array.Base","entity":"value"},{"name":"UArray","module":"Data.Array.Base","entity":"data"},{"name":"UArray","module":"Data.Array.Base","type":"UArray","entity":"constructor"},{"name":"unsafeArrayUArray","module":"Data.Array.Base","entity":"value"},{"name":"unsafeFreezeSTUArray","module":"Data.Array.Base","entity":"value"},{"name":"unsafeReplaceUArray","module":"Data.Array.Base","entity":"value"},{"name":"unsafeAccumUArray","module":"Data.Array.Base","entity":"value"},{"name":"unsafeAccumArrayUArray","module":"Data.Array.Base","entity":"value"},{"name":"eqUArray","module":"Data.Array.Base","entity":"value"},{"name":"cmpUArray","module":"Data.Array.Base","entity":"value"},{"name":"cmpIntUArray","module":"Data.Array.Base","entity":"value"},{"name":"showsIArray","module":"Data.Array.Base","entity":"value"},{"name":"nullStablePtr","module":"Data.Array.Base","entity":"value"},{"name":"arrEleBottom","module":"Data.Array.Base","entity":"value"},{"name":"MArray","module":"Data.Array.Base","entity":"class"},{"name":"getBounds","module":"Data.Array.Base","entity":"method","class":"MArray"},{"name":"getNumElements","module":"Data.Array.Base","entity":"method","class":"MArray"},{"name":"newArray","module":"Data.Array.Base","entity":"method","class":"MArray"},{"name":"newArray_","module":"Data.Array.Base","entity":"method","class":"MArray"},{"name":"unsafeNewArray_","module":"Data.Array.Base","entity":"method","class":"MArray"},{"name":"unsafeRead","module":"Data.Array.Base","entity":"method","class":"MArray"},{"name":"unsafeWrite","module":"Data.Array.Base","entity":"method","class":"MArray"},{"name":"newListArray","module":"Data.Array.Base","entity":"value"},{"name":"readArray","module":"Data.Array.Base","entity":"value"},{"name":"writeArray","module":"Data.Array.Base","entity":"value"},{"name":"getElems","module":"Data.Array.Base","entity":"value"},{"name":"getAssocs","module":"Data.Array.Base","entity":"value"},{"name":"mapArray","module":"Data.Array.Base","entity":"value"},{"name":"mapIndices","module":"Data.Array.Base","entity":"value"},{"name":"STUArray","module":"Data.Array.Base","entity":"data"},{"name":"STUArray","module":"Data.Array.Base","type":"STUArray","entity":"constructor"},{"name":"unsafeNewArraySTUArray_","module":"Data.Array.Base","entity":"value"},{"name":"bOOL_SCALE","module":"Data.Array.Base","entity":"value"},{"name":"bOOL_WORD_SCALE","module":"Data.Array.Base","entity":"value"},{"name":"wORD_SCALE","module":"Data.Array.Base","entity":"value"},{"name":"dOUBLE_SCALE","module":"Data.Array.Base","entity":"value"},{"name":"fLOAT_SCALE","module":"Data.Array.Base","entity":"value"},{"name":"bOOL_INDEX","module":"Data.Array.Base","entity":"value"},{"name":"bOOL_BIT","module":"Data.Array.Base","entity":"value"},{"name":"bOOL_NOT_BIT","module":"Data.Array.Base","entity":"value"},{"name":"freeze","module":"Data.Array.Base","entity":"value"},{"name":"freezeSTUArray","module":"Data.Array.Base","entity":"value"},{"name":"memcpy_freeze","module":"Data.Array.Base","entity":"value"},{"name":"unsafeFreeze","module":"Data.Array.Base","entity":"value"},{"name":"thaw","module":"Data.Array.Base","entity":"value"},{"name":"thawSTUArray","module":"Data.Array.Base","entity":"value"},{"name":"memcpy_thaw","module":"Data.Array.Base","entity":"value"},{"name":"unsafeThaw","module":"Data.Array.Base","entity":"value"},{"name":"unsafeThawSTUArray","module":"Data.Array.Base","entity":"value"},{"name":"unsafeThawIOArray","module":"Data.Array.Base","entity":"value"},{"name":"thawIOArray","module":"Data.Array.Base","entity":"value"},{"name":"freezeIOArray","module":"Data.Array.Base","entity":"value"},{"name":"unsafeFreezeIOArray","module":"Data.Array.Base","entity":"value"},{"name":"castSTUArray","module":"Data.Array.Base","entity":"value"}] diff --git a/libraries/array-0.4.0.2/Data/Array/IArray.names b/libraries/array-0.4.0.2/Data/Array/IArray.names deleted file mode 100644 index 9d25258..0000000 --- a/libraries/array-0.4.0.2/Data/Array/IArray.names +++ /dev/null @@ -1 +0,0 @@ -[{"name":"IArray","module":"Data.Array.Base","entity":"class"},{"name":"inRange","module":"GHC.Arr","entity":"method","class":"Ix"},{"name":"index","module":"GHC.Arr","entity":"method","class":"Ix"},{"name":"range","module":"GHC.Arr","entity":"method","class":"Ix"},{"name":"rangeSize","module":"GHC.Arr","entity":"method","class":"Ix"},{"name":"Ix","module":"GHC.Arr","entity":"class"},{"name":"Array","module":"GHC.Arr","entity":"data"},{"name":"array","module":"Data.Array.Base","entity":"value"},{"name":"listArray","module":"Data.Array.Base","entity":"value"},{"name":"accumArray","module":"Data.Array.Base","entity":"value"},{"name":"!","module":"Data.Array.Base","entity":"value"},{"name":"bounds","module":"Data.Array.Base","entity":"method","class":"IArray"},{"name":"indices","module":"Data.Array.Base","entity":"value"},{"name":"elems","module":"Data.Array.Base","entity":"value"},{"name":"assocs","module":"Data.Array.Base","entity":"value"},{"name":"//","module":"Data.Array.Base","entity":"value"},{"name":"accum","module":"Data.Array.Base","entity":"value"},{"name":"amap","module":"Data.Array.Base","entity":"value"},{"name":"ixmap","module":"Data.Array.Base","entity":"value"}] diff --git a/libraries/array-0.4.0.2/Data/Array/IO.names b/libraries/array-0.4.0.2/Data/Array/IO.names deleted file mode 100644 index 7963c74..0000000 --- a/libraries/array-0.4.0.2/Data/Array/IO.names +++ /dev/null @@ -1 +0,0 @@ -[{"name":"IOArray","module":"GHC.IOArray","entity":"newtype"},{"name":"IOUArray","module":"Data.Array.IO.Internals","entity":"newtype"},{"name":"castIOUArray","module":"Data.Array.IO","entity":"value"},{"name":"freeze","module":"Data.Array.Base","entity":"value"},{"name":"getAssocs","module":"Data.Array.Base","entity":"value"},{"name":"getElems","module":"Data.Array.Base","entity":"value"},{"name":"mapArray","module":"Data.Array.Base","entity":"value"},{"name":"mapIndices","module":"Data.Array.Base","entity":"value"},{"name":"newListArray","module":"Data.Array.Base","entity":"value"},{"name":"readArray","module":"Data.Array.Base","entity":"value"},{"name":"thaw","module":"Data.Array.Base","entity":"value"},{"name":"writeArray","module":"Data.Array.Base","entity":"value"},{"name":"unsafeFreeze","module":"Data.Array.MArray","entity":"value"},{"name":"unsafeThaw","module":"Data.Array.MArray","entity":"value"},{"name":"getBounds","module":"Data.Array.Base","entity":"method","class":"MArray"},{"name":"newArray","module":"Data.Array.Base","entity":"method","class":"MArray"},{"name":"newArray_","module":"Data.Array.Base","entity":"method","class":"MArray"},{"name":"inRange","module":"GHC.Arr","entity":"method","class":"Ix"},{"name":"index","module":"GHC.Arr","entity":"method","class":"Ix"},{"name":"range","module":"GHC.Arr","entity":"method","class":"Ix"},{"name":"rangeSize","module":"GHC.Arr","entity":"method","class":"Ix"},{"name":"MArray","module":"Data.Array.Base","entity":"class"},{"name":"Ix","module":"GHC.Arr","entity":"class"},{"name":"hGetArray","module":"Data.Array.IO","entity":"value"},{"name":"hPutArray","module":"Data.Array.IO","entity":"value"}] diff --git a/libraries/array-0.4.0.2/Data/Array/IO/Internals.names b/libraries/array-0.4.0.2/Data/Array/IO/Internals.names deleted file mode 100644 index 715a1a6..0000000 --- a/libraries/array-0.4.0.2/Data/Array/IO/Internals.names +++ /dev/null @@ -1 +0,0 @@ -[{"name":"IOArray","module":"GHC.IOArray","entity":"newtype"},{"name":"IOArray","module":"GHC.IOArray","type":"IOArray","entity":"constructor"},{"name":"IOUArray","module":"Data.Array.IO.Internals","entity":"newtype"},{"name":"IOUArray","module":"Data.Array.IO.Internals","type":"IOUArray","entity":"constructor"},{"name":"castIOUArray","module":"Data.Array.IO.Internals","entity":"value"},{"name":"unsafeThawIOUArray","module":"Data.Array.IO.Internals","entity":"value"}] diff --git a/libraries/array-0.4.0.2/Data/Array/IO/Safe.names b/libraries/array-0.4.0.2/Data/Array/IO/Safe.names deleted file mode 100644 index 4924728..0000000 --- a/libraries/array-0.4.0.2/Data/Array/IO/Safe.names +++ /dev/null @@ -1 +0,0 @@ -[{"name":"IOArray","module":"GHC.IOArray","entity":"newtype"},{"name":"IOUArray","module":"Data.Array.IO.Internals","entity":"newtype"},{"name":"freeze","module":"Data.Array.Base","entity":"value"},{"name":"getAssocs","module":"Data.Array.Base","entity":"value"},{"name":"getElems","module":"Data.Array.Base","entity":"value"},{"name":"mapArray","module":"Data.Array.Base","entity":"value"},{"name":"mapIndices","module":"Data.Array.Base","entity":"value"},{"name":"newListArray","module":"Data.Array.Base","entity":"value"},{"name":"readArray","module":"Data.Array.Base","entity":"value"},{"name":"thaw","module":"Data.Array.Base","entity":"value"},{"name":"writeArray","module":"Data.Array.Base","entity":"value"},{"name":"getBounds","module":"Data.Array.Base","entity":"method","class":"MArray"},{"name":"newArray","module":"Data.Array.Base","entity":"method","class":"MArray"},{"name":"newArray_","module":"Data.Array.Base","entity":"method","class":"MArray"},{"name":"inRange","module":"GHC.Arr","entity":"method","class":"Ix"},{"name":"index","module":"GHC.Arr","entity":"method","class":"Ix"},{"name":"range","module":"GHC.Arr","entity":"method","class":"Ix"},{"name":"rangeSize","module":"GHC.Arr","entity":"method","class":"Ix"},{"name":"MArray","module":"Data.Array.Base","entity":"class"},{"name":"Ix","module":"GHC.Arr","entity":"class"},{"name":"hGetArray","module":"Data.Array.IO","entity":"value"},{"name":"hPutArray","module":"Data.Array.IO","entity":"value"}] diff --git a/libraries/array-0.4.0.2/Data/Array/MArray.names b/libraries/array-0.4.0.2/Data/Array/MArray.names deleted file mode 100644 index 5fe109a..0000000 --- a/libraries/array-0.4.0.2/Data/Array/MArray.names +++ /dev/null @@ -1 +0,0 @@ -[{"name":"MArray","module":"Data.Array.Base","entity":"class"},{"name":"inRange","module":"GHC.Arr","entity":"method","class":"Ix"},{"name":"index","module":"GHC.Arr","entity":"method","class":"Ix"},{"name":"range","module":"GHC.Arr","entity":"method","class":"Ix"},{"name":"rangeSize","module":"GHC.Arr","entity":"method","class":"Ix"},{"name":"Ix","module":"GHC.Arr","entity":"class"},{"name":"newArray","module":"Data.Array.Base","entity":"method","class":"MArray"},{"name":"newArray_","module":"Data.Array.Base","entity":"method","class":"MArray"},{"name":"newListArray","module":"Data.Array.Base","entity":"value"},{"name":"readArray","module":"Data.Array.Base","entity":"value"},{"name":"writeArray","module":"Data.Array.Base","entity":"value"},{"name":"mapArray","module":"Data.Array.Base","entity":"value"},{"name":"mapIndices","module":"Data.Array.Base","entity":"value"},{"name":"getBounds","module":"Data.Array.Base","entity":"method","class":"MArray"},{"name":"getElems","module":"Data.Array.Base","entity":"value"},{"name":"getAssocs","module":"Data.Array.Base","entity":"value"},{"name":"freeze","module":"Data.Array.Base","entity":"value"},{"name":"unsafeFreeze","module":"Data.Array.MArray","entity":"value"},{"name":"thaw","module":"Data.Array.Base","entity":"value"},{"name":"unsafeThaw","module":"Data.Array.MArray","entity":"value"}] diff --git a/libraries/array-0.4.0.2/Data/Array/MArray/Safe.names b/libraries/array-0.4.0.2/Data/Array/MArray/Safe.names deleted file mode 100644 index b9d2ddf..0000000 --- a/libraries/array-0.4.0.2/Data/Array/MArray/Safe.names +++ /dev/null @@ -1 +0,0 @@ -[{"name":"MArray","module":"Data.Array.Base","entity":"class"},{"name":"inRange","module":"GHC.Arr","entity":"method","class":"Ix"},{"name":"index","module":"GHC.Arr","entity":"method","class":"Ix"},{"name":"range","module":"GHC.Arr","entity":"method","class":"Ix"},{"name":"rangeSize","module":"GHC.Arr","entity":"method","class":"Ix"},{"name":"Ix","module":"GHC.Arr","entity":"class"},{"name":"newArray","module":"Data.Array.Base","entity":"method","class":"MArray"},{"name":"newArray_","module":"Data.Array.Base","entity":"method","class":"MArray"},{"name":"newListArray","module":"Data.Array.Base","entity":"value"},{"name":"readArray","module":"Data.Array.Base","entity":"value"},{"name":"writeArray","module":"Data.Array.Base","entity":"value"},{"name":"mapArray","module":"Data.Array.Base","entity":"value"},{"name":"mapIndices","module":"Data.Array.Base","entity":"value"},{"name":"getBounds","module":"Data.Array.Base","entity":"method","class":"MArray"},{"name":"getElems","module":"Data.Array.Base","entity":"value"},{"name":"getAssocs","module":"Data.Array.Base","entity":"value"},{"name":"freeze","module":"Data.Array.Base","entity":"value"},{"name":"thaw","module":"Data.Array.Base","entity":"value"}] diff --git a/libraries/array-0.4.0.2/Data/Array/ST.names b/libraries/array-0.4.0.2/Data/Array/ST.names deleted file mode 100644 index 7a4676e..0000000 --- a/libraries/array-0.4.0.2/Data/Array/ST.names +++ /dev/null @@ -1 +0,0 @@ -[{"name":"STArray","module":"GHC.Arr","entity":"data"},{"name":"runSTArray","module":"Data.Array.ST","entity":"value"},{"name":"STUArray","module":"Data.Array.Base","entity":"data"},{"name":"runSTUArray","module":"Data.Array.ST","entity":"value"},{"name":"castSTUArray","module":"Data.Array.ST","entity":"value"},{"name":"freeze","module":"Data.Array.Base","entity":"value"},{"name":"getAssocs","module":"Data.Array.Base","entity":"value"},{"name":"getElems","module":"Data.Array.Base","entity":"value"},{"name":"mapArray","module":"Data.Array.Base","entity":"value"},{"name":"mapIndices","module":"Data.Array.Base","entity":"value"},{"name":"newListArray","module":"Data.Array.Base","entity":"value"},{"name":"readArray","module":"Data.Array.Base","entity":"value"},{"name":"thaw","module":"Data.Array.Base","entity":"value"},{"name":"writeArray","module":"Data.Array.Base","entity":"value"},{"name":"unsafeFreeze","module":"Data.Array.MArray","entity":"value"},{"name":"unsafeThaw","module":"Data.Array.MArray","entity":"value"},{"name":"getBounds","module":"Data.Array.Base","entity":"method","class":"MArray"},{"name":"newArray","module":"Data.Array.Base","entity":"method","class":"MArray"},{"name":"newArray_","module":"Data.Array.Base","entity":"method","class":"MArray"},{"name":"inRange","module":"GHC.Arr","entity":"method","class":"Ix"},{"name":"index","module":"GHC.Arr","entity":"method","class":"Ix"},{"name":"range","module":"GHC.Arr","entity":"method","class":"Ix"},{"name":"rangeSize","module":"GHC.Arr","entity":"method","class":"Ix"},{"name":"MArray","module":"Data.Array.Base","entity":"class"},{"name":"Ix","module":"GHC.Arr","entity":"class"}] diff --git a/libraries/array-0.4.0.2/Data/Array/ST/Safe.names b/libraries/array-0.4.0.2/Data/Array/ST/Safe.names deleted file mode 100644 index 0c9a66b..0000000 --- a/libraries/array-0.4.0.2/Data/Array/ST/Safe.names +++ /dev/null @@ -1 +0,0 @@ -[{"name":"STArray","module":"GHC.Arr","entity":"data"},{"name":"runSTArray","module":"Data.Array.ST","entity":"value"},{"name":"STUArray","module":"Data.Array.Base","entity":"data"},{"name":"runSTUArray","module":"Data.Array.ST","entity":"value"},{"name":"freeze","module":"Data.Array.Base","entity":"value"},{"name":"getAssocs","module":"Data.Array.Base","entity":"value"},{"name":"getElems","module":"Data.Array.Base","entity":"value"},{"name":"mapArray","module":"Data.Array.Base","entity":"value"},{"name":"mapIndices","module":"Data.Array.Base","entity":"value"},{"name":"newListArray","module":"Data.Array.Base","entity":"value"},{"name":"readArray","module":"Data.Array.Base","entity":"value"},{"name":"thaw","module":"Data.Array.Base","entity":"value"},{"name":"writeArray","module":"Data.Array.Base","entity":"value"},{"name":"getBounds","module":"Data.Array.Base","entity":"method","class":"MArray"},{"name":"newArray","module":"Data.Array.Base","entity":"method","class":"MArray"},{"name":"newArray_","module":"Data.Array.Base","entity":"method","class":"MArray"},{"name":"inRange","module":"GHC.Arr","entity":"method","class":"Ix"},{"name":"index","module":"GHC.Arr","entity":"method","class":"Ix"},{"name":"range","module":"GHC.Arr","entity":"method","class":"Ix"},{"name":"rangeSize","module":"GHC.Arr","entity":"method","class":"Ix"},{"name":"MArray","module":"Data.Array.Base","entity":"class"},{"name":"Ix","module":"GHC.Arr","entity":"class"}] diff --git a/libraries/array-0.4.0.2/Data/Array/Storable.names b/libraries/array-0.4.0.2/Data/Array/Storable.names deleted file mode 100644 index f84c07e..0000000 --- a/libraries/array-0.4.0.2/Data/Array/Storable.names +++ /dev/null @@ -1 +0,0 @@ -[{"name":"StorableArray","module":"Data.Array.Storable.Internals","entity":"data"},{"name":"freeze","module":"Data.Array.Base","entity":"value"},{"name":"getAssocs","module":"Data.Array.Base","entity":"value"},{"name":"getElems","module":"Data.Array.Base","entity":"value"},{"name":"mapArray","module":"Data.Array.Base","entity":"value"},{"name":"mapIndices","module":"Data.Array.Base","entity":"value"},{"name":"newListArray","module":"Data.Array.Base","entity":"value"},{"name":"readArray","module":"Data.Array.Base","entity":"value"},{"name":"thaw","module":"Data.Array.Base","entity":"value"},{"name":"writeArray","module":"Data.Array.Base","entity":"value"},{"name":"unsafeFreeze","module":"Data.Array.MArray","entity":"value"},{"name":"unsafeThaw","module":"Data.Array.MArray","entity":"value"},{"name":"getBounds","module":"Data.Array.Base","entity":"method","class":"MArray"},{"name":"newArray","module":"Data.Array.Base","entity":"method","class":"MArray"},{"name":"newArray_","module":"Data.Array.Base","entity":"method","class":"MArray"},{"name":"inRange","module":"GHC.Arr","entity":"method","class":"Ix"},{"name":"index","module":"GHC.Arr","entity":"method","class":"Ix"},{"name":"range","module":"GHC.Arr","entity":"method","class":"Ix"},{"name":"rangeSize","module":"GHC.Arr","entity":"method","class":"Ix"},{"name":"MArray","module":"Data.Array.Base","entity":"class"},{"name":"Ix","module":"GHC.Arr","entity":"class"},{"name":"withStorableArray","module":"Data.Array.Storable.Internals","entity":"value"},{"name":"touchStorableArray","module":"Data.Array.Storable.Internals","entity":"value"},{"name":"unsafeForeignPtrToStorableArray","module":"Data.Array.Storable","entity":"value"}] diff --git a/libraries/array-0.4.0.2/Data/Array/Storable/Internals.names b/libraries/array-0.4.0.2/Data/Array/Storable/Internals.names deleted file mode 100644 index fae7854..0000000 --- a/libraries/array-0.4.0.2/Data/Array/Storable/Internals.names +++ /dev/null @@ -1 +0,0 @@ -[{"name":"StorableArray","module":"Data.Array.Storable.Internals","entity":"data"},{"name":"StorableArray","module":"Data.Array.Storable.Internals","type":"StorableArray","entity":"constructor"},{"name":"withStorableArray","module":"Data.Array.Storable.Internals","entity":"value"},{"name":"touchStorableArray","module":"Data.Array.Storable.Internals","entity":"value"},{"name":"unsafeForeignPtrToStorableArray","module":"Data.Array.Storable.Internals","entity":"value"}] diff --git a/libraries/array-0.4.0.2/Data/Array/Storable/Safe.names b/libraries/array-0.4.0.2/Data/Array/Storable/Safe.names deleted file mode 100644 index bf20bd9..0000000 --- a/libraries/array-0.4.0.2/Data/Array/Storable/Safe.names +++ /dev/null @@ -1 +0,0 @@ -[{"name":"StorableArray","module":"Data.Array.Storable.Internals","entity":"data"},{"name":"freeze","module":"Data.Array.Base","entity":"value"},{"name":"getAssocs","module":"Data.Array.Base","entity":"value"},{"name":"getElems","module":"Data.Array.Base","entity":"value"},{"name":"mapArray","module":"Data.Array.Base","entity":"value"},{"name":"mapIndices","module":"Data.Array.Base","entity":"value"},{"name":"newListArray","module":"Data.Array.Base","entity":"value"},{"name":"readArray","module":"Data.Array.Base","entity":"value"},{"name":"thaw","module":"Data.Array.Base","entity":"value"},{"name":"writeArray","module":"Data.Array.Base","entity":"value"},{"name":"getBounds","module":"Data.Array.Base","entity":"method","class":"MArray"},{"name":"newArray","module":"Data.Array.Base","entity":"method","class":"MArray"},{"name":"newArray_","module":"Data.Array.Base","entity":"method","class":"MArray"},{"name":"inRange","module":"GHC.Arr","entity":"method","class":"Ix"},{"name":"index","module":"GHC.Arr","entity":"method","class":"Ix"},{"name":"range","module":"GHC.Arr","entity":"method","class":"Ix"},{"name":"rangeSize","module":"GHC.Arr","entity":"method","class":"Ix"},{"name":"MArray","module":"Data.Array.Base","entity":"class"},{"name":"Ix","module":"GHC.Arr","entity":"class"},{"name":"withStorableArray","module":"Data.Array.Storable.Internals","entity":"value"},{"name":"touchStorableArray","module":"Data.Array.Storable.Internals","entity":"value"}] diff --git a/libraries/array-0.4.0.2/Data/Array/Unboxed.names b/libraries/array-0.4.0.2/Data/Array/Unboxed.names deleted file mode 100644 index 81d299f..0000000 --- a/libraries/array-0.4.0.2/Data/Array/Unboxed.names +++ /dev/null @@ -1 +0,0 @@ -[{"name":"UArray","module":"Data.Array.Base","entity":"data"},{"name":"accum","module":"Data.Array.Base","entity":"value"},{"name":"accumArray","module":"Data.Array.Base","entity":"value"},{"name":"amap","module":"Data.Array.Base","entity":"value"},{"name":"array","module":"Data.Array.Base","entity":"value"},{"name":"assocs","module":"Data.Array.Base","entity":"value"},{"name":"elems","module":"Data.Array.Base","entity":"value"},{"name":"indices","module":"Data.Array.Base","entity":"value"},{"name":"ixmap","module":"Data.Array.Base","entity":"value"},{"name":"listArray","module":"Data.Array.Base","entity":"value"},{"name":"!","module":"Data.Array.Base","entity":"value"},{"name":"//","module":"Data.Array.Base","entity":"value"},{"name":"bounds","module":"Data.Array.Base","entity":"method","class":"IArray"},{"name":"inRange","module":"GHC.Arr","entity":"method","class":"Ix"},{"name":"index","module":"GHC.Arr","entity":"method","class":"Ix"},{"name":"range","module":"GHC.Arr","entity":"method","class":"Ix"},{"name":"rangeSize","module":"GHC.Arr","entity":"method","class":"Ix"},{"name":"Array","module":"GHC.Arr","entity":"data"},{"name":"IArray","module":"Data.Array.Base","entity":"class"},{"name":"Ix","module":"GHC.Arr","entity":"class"}] diff --git a/libraries/array-0.4.0.2/Data/Array/Unsafe.names b/libraries/array-0.4.0.2/Data/Array/Unsafe.names deleted file mode 100644 index 1cabb0c..0000000 --- a/libraries/array-0.4.0.2/Data/Array/Unsafe.names +++ /dev/null @@ -1 +0,0 @@ -[{"name":"castSTUArray","module":"Data.Array.Base","entity":"value"},{"name":"castIOUArray","module":"Data.Array.IO.Internals","entity":"value"},{"name":"unsafeFreeze","module":"Data.Array.Base","entity":"value"},{"name":"unsafeThaw","module":"Data.Array.Base","entity":"value"},{"name":"unsafeForeignPtrToStorableArray","module":"Data.Array.Storable.Internals","entity":"value"}] diff --git a/libraries/base-4.7.0.0/include/EventConfig.h b/libraries/base-4.7.0.0/include/EventConfig.h deleted file mode 100644 index 945a795..0000000 --- a/libraries/base-4.7.0.0/include/EventConfig.h +++ /dev/null @@ -1,92 +0,0 @@ -/* include/EventConfig.h. Generated from EventConfig.h.in by configure. */ -/* include/EventConfig.h.in. Generated from configure.ac by autoheader. */ - -/* Define if you have epoll support. */ -#define HAVE_EPOLL 1 - -/* Define to 1 if you have the `epoll_create1' function. */ -/* #undef HAVE_EPOLL_CREATE1 */ - -/* Define to 1 if you have the `epoll_ctl' function. */ -#define HAVE_EPOLL_CTL 1 - -/* Define to 1 if you have the `eventfd' function. */ -#define HAVE_EVENTFD 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_INTTYPES_H 1 - -/* Define to 1 if you have the `kevent' function. */ -/* #undef HAVE_KEVENT */ - -/* Define to 1 if you have the `kevent64' function. */ -/* #undef HAVE_KEVENT64 */ - -/* Define if you have kqueue support. */ -/* #undef HAVE_KQUEUE */ - -/* Define to 1 if you have the header file. */ -#define HAVE_MEMORY_H 1 - -/* Define if you have poll support. */ -#define HAVE_POLL 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_POLL_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_SIGNAL_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_STDINT_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_STDLIB_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_STRINGS_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_STRING_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_SYS_EPOLL_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_SYS_EVENTFD_H 1 - -/* Define to 1 if you have the header file. */ -/* #undef HAVE_SYS_EVENT_H */ - -/* Define to 1 if you have the header file. */ -#define HAVE_SYS_STAT_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_SYS_TYPES_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_UNISTD_H 1 - -/* Define to the address where bug reports for this package should be sent. */ -#define PACKAGE_BUGREPORT "libraries@haskell.org" - -/* Define to the full name of this package. */ -#define PACKAGE_NAME "Haskell base package" - -/* Define to the full name and version of this package. */ -#define PACKAGE_STRING "Haskell base package 1.0" - -/* Define to the one symbol short name of this package. */ -#define PACKAGE_TARNAME "base" - -/* Define to the version of this package. */ -#define PACKAGE_VERSION "1.0" - -/* Define to 1 if you have the ANSI C header files. */ -#define STDC_HEADERS 1 - -/* The size of `kev.filter', as computed by sizeof. */ -/* #undef SIZEOF_KEV_FILTER */ - -/* The size of `kev.flags', as computed by sizeof. */ -/* #undef SIZEOF_KEV_FLAGS */ diff --git a/libraries/base-4.7.0.0/include/HsBase.h b/libraries/base-4.7.0.0/include/HsBase.h deleted file mode 100644 index b70a729..0000000 --- a/libraries/base-4.7.0.0/include/HsBase.h +++ /dev/null @@ -1,563 +0,0 @@ -/* ----------------------------------------------------------------------------- - * - * (c) The University of Glasgow 2001-2004 - * - * Definitions for package `base' which are visible in Haskell land. - * - * ---------------------------------------------------------------------------*/ - -#ifndef __HSBASE_H__ -#define __HSBASE_H__ - -#include "HsBaseConfig.h" - -/* ultra-evil... */ -#undef PACKAGE_BUGREPORT -#undef PACKAGE_NAME -#undef PACKAGE_STRING -#undef PACKAGE_TARNAME -#undef PACKAGE_VERSION - -/* Needed to get the macro version of errno on some OSs (eg. Solaris). - We must do this, because these libs are only compiled once, but - must work in both single-threaded and multi-threaded programs. */ -#define _REENTRANT 1 - -#include "HsFFI.h" - -#include -#include -#include - -#if HAVE_SYS_TYPES_H -#include -#endif -#if HAVE_UNISTD_H -#include -#endif -#if HAVE_SYS_STAT_H -#include -#endif -#if HAVE_FCNTL_H -# include -#endif -#if HAVE_TERMIOS_H -#include -#endif -#if HAVE_SIGNAL_H -#include -/* Ultra-ugly: OpenBSD uses broken macros for sigemptyset and sigfillset (missing casts) */ -#if __OpenBSD__ -#undef sigemptyset -#undef sigfillset -#endif -#endif -#if HAVE_ERRNO_H -#include -#endif -#if HAVE_STRING_H -#include -#endif -#if HAVE_UTIME_H -#include -#endif -#if HAVE_SYS_UTSNAME_H -#include -#endif -#if HAVE_GETTIMEOFDAY -# if HAVE_SYS_TIME_H -# include -# endif -#elif HAVE_GETCLOCK -# if HAVE_SYS_TIMERS_H -# define POSIX_4D9 1 -# include -# endif -#endif -#if HAVE_TIME_H -#include -#endif -#if HAVE_SYS_TIMEB_H && !defined(__FreeBSD__) -#include -#endif -#if HAVE_WINDOWS_H -#include -#endif -#if HAVE_SYS_TIMES_H -#include -#endif -#if HAVE_WINSOCK_H && defined(__MINGW32__) -#include -#endif -#if HAVE_LIMITS_H -#include -#endif -#if HAVE_WCTYPE_H -#include -#endif -#if HAVE_INTTYPES_H -# include -#elif HAVE_STDINT_H -# include -#endif -#if HAVE_CLOCK_GETTIME -# ifdef _POSIX_MONOTONIC_CLOCK -# define CLOCK_ID CLOCK_MONOTONIC -# else -# define CLOCK_ID CLOCK_REALTIME -# endif -#elif defined(darwin_HOST_OS) -# include -# include -#endif - -#if !defined(__MINGW32__) && !defined(irix_HOST_OS) -# if HAVE_SYS_RESOURCE_H -# include -# endif -#endif - -#if !HAVE_GETRUSAGE && HAVE_SYS_SYSCALL_H -# include -# if defined(SYS_GETRUSAGE) /* hpux_HOST_OS */ -# define getrusage(a, b) syscall(SYS_GETRUSAGE, a, b) -# define HAVE_GETRUSAGE 1 -# endif -#endif - -/* For System */ -#if HAVE_SYS_WAIT_H -#include -#endif -#if HAVE_VFORK_H -#include -#endif -#include "WCsubst.h" - -#if defined(__MINGW32__) -/* in Win32Utils.c */ -extern void maperrno (void); -extern int maperrno_func(DWORD dwErrorCode); -extern HsWord64 getMonotonicUSec(void); -#endif - -#if defined(__MINGW32__) -#include -#include -#include -#include -#endif - -#if HAVE_SYS_SELECT_H -#include -#endif - -/* in inputReady.c */ -extern int fdReady(int fd, int write, int msecs, int isSock); - -/* ----------------------------------------------------------------------------- - INLINE functions. - - These functions are given as inlines here for when compiling via C, - but we also generate static versions into the cbits library for - when compiling to native code. - -------------------------------------------------------------------------- */ - -#ifndef INLINE -# if defined(_MSC_VER) -# define INLINE extern __inline -# else -# define INLINE static inline -# endif -#endif - -INLINE int __hscore_get_errno(void) { return errno; } -INLINE void __hscore_set_errno(int e) { errno = e; } - -INLINE HsInt -__hscore_bufsiz(void) -{ - return BUFSIZ; -} - -INLINE int -__hscore_o_binary(void) -{ -#if defined(_MSC_VER) - return O_BINARY; -#else - return CONST_O_BINARY; -#endif -} - -INLINE int -__hscore_o_rdonly(void) -{ -#ifdef O_RDONLY - return O_RDONLY; -#else - return 0; -#endif -} - -INLINE int -__hscore_o_wronly( void ) -{ -#ifdef O_WRONLY - return O_WRONLY; -#else - return 0; -#endif -} - -INLINE int -__hscore_o_rdwr( void ) -{ -#ifdef O_RDWR - return O_RDWR; -#else - return 0; -#endif -} - -INLINE int -__hscore_o_append( void ) -{ -#ifdef O_APPEND - return O_APPEND; -#else - return 0; -#endif -} - -INLINE int -__hscore_o_creat( void ) -{ -#ifdef O_CREAT - return O_CREAT; -#else - return 0; -#endif -} - -INLINE int -__hscore_o_excl( void ) -{ -#ifdef O_EXCL - return O_EXCL; -#else - return 0; -#endif -} - -INLINE int -__hscore_o_trunc( void ) -{ -#ifdef O_TRUNC - return O_TRUNC; -#else - return 0; -#endif -} - -INLINE int -__hscore_o_noctty( void ) -{ -#ifdef O_NOCTTY - return O_NOCTTY; -#else - return 0; -#endif -} - -INLINE int -__hscore_o_nonblock( void ) -{ -#ifdef O_NONBLOCK - return O_NONBLOCK; -#else - return 0; -#endif -} - -INLINE int -__hscore_ftruncate( int fd, off_t where ) -{ -#if defined(HAVE_FTRUNCATE) - return ftruncate(fd,where); -#elif defined(HAVE__CHSIZE) - return _chsize(fd,where); -#else -// ToDo: we should use _chsize_s() on Windows which allows a 64-bit -// offset, but it doesn't seem to be available from mingw at this time -// --SDM (01/2008) -#error at least ftruncate or _chsize functions are required to build -#endif -} - -INLINE int -__hscore_setmode( int fd, HsBool toBin ) -{ -#if defined(_MSC_VER) || defined(__MINGW32__) || defined(_WIN32) - return setmode(fd,(toBin == HS_BOOL_TRUE) ? _O_BINARY : _O_TEXT); -#else - return 0; -#endif -} - -#if __GLASGOW_HASKELL__ - -#endif /* __GLASGOW_HASKELL__ */ - -#if defined(__MINGW32__) -// We want the versions of stat/fstat/lseek that use 64-bit offsets, -// and you have to ask for those explicitly. Unfortunately there -// doesn't seem to be a 64-bit version of truncate/ftruncate, so while -// hFileSize and hSeek will work with large files, hSetFileSize will not. -typedef struct _stati64 struct_stat; -typedef off64_t stsize_t; -#else -typedef struct stat struct_stat; -typedef off_t stsize_t; -#endif - -INLINE HsInt -__hscore_sizeof_stat( void ) -{ - return sizeof(struct_stat); -} - -INLINE time_t __hscore_st_mtime ( struct_stat* st ) { return st->st_mtime; } -INLINE stsize_t __hscore_st_size ( struct_stat* st ) { return st->st_size; } -#if !defined(_MSC_VER) -INLINE mode_t __hscore_st_mode ( struct_stat* st ) { return st->st_mode; } -INLINE dev_t __hscore_st_dev ( struct_stat* st ) { return st->st_dev; } -INLINE ino_t __hscore_st_ino ( struct_stat* st ) { return st->st_ino; } -#endif - -#if defined(__MINGW32__) -INLINE int __hscore_stat(wchar_t *file, struct_stat *buf) { - return _wstati64(file,buf); -} - -INLINE int __hscore_fstat(int fd, struct_stat *buf) { - return _fstati64(fd,buf); -} -INLINE int __hscore_lstat(wchar_t *fname, struct_stat *buf ) -{ - return _wstati64(fname,buf); -} -#else -INLINE int __hscore_stat(char *file, struct_stat *buf) { - return stat(file,buf); -} - -INLINE int __hscore_fstat(int fd, struct_stat *buf) { - return fstat(fd,buf); -} - -INLINE int __hscore_lstat( const char *fname, struct stat *buf ) -{ -#if HAVE_LSTAT - return lstat(fname, buf); -#else - return stat(fname, buf); -#endif -} -#endif - -#if HAVE_TERMIOS_H -INLINE tcflag_t __hscore_lflag( struct termios* ts ) { return ts->c_lflag; } - -INLINE void -__hscore_poke_lflag( struct termios* ts, tcflag_t t ) { ts->c_lflag = t; } - -INLINE unsigned char* -__hscore_ptr_c_cc( struct termios* ts ) -{ return (unsigned char*) &ts->c_cc; } - -INLINE HsInt -__hscore_sizeof_termios( void ) -{ -#ifndef __MINGW32__ - return sizeof(struct termios); -#else - return 0; -#endif -} -#endif - -#if !defined(_MSC_VER) && !defined(__MINGW32__) && !defined(_WIN32) -INLINE HsInt -__hscore_sizeof_sigset_t( void ) -{ - return sizeof(sigset_t); -} -#endif - -INLINE int -__hscore_echo( void ) -{ -#ifdef ECHO - return ECHO; -#else - return 0; -#endif - -} - -INLINE int -__hscore_tcsanow( void ) -{ -#ifdef TCSANOW - return TCSANOW; -#else - return 0; -#endif - -} - -INLINE int -__hscore_icanon( void ) -{ -#ifdef ICANON - return ICANON; -#else - return 0; -#endif -} - -INLINE int __hscore_vmin( void ) -{ -#ifdef VMIN - return VMIN; -#else - return 0; -#endif -} - -INLINE int __hscore_vtime( void ) -{ -#ifdef VTIME - return VTIME; -#else - return 0; -#endif -} - -INLINE int __hscore_sigttou( void ) -{ -#ifdef SIGTTOU - return SIGTTOU; -#else - return 0; -#endif -} - -INLINE int __hscore_sig_block( void ) -{ -#ifdef SIG_BLOCK - return SIG_BLOCK; -#else - return 0; -#endif -} - -INLINE int __hscore_sig_setmask( void ) -{ -#ifdef SIG_SETMASK - return SIG_SETMASK; -#else - return 0; -#endif -} - -#ifndef __MINGW32__ -INLINE size_t __hscore_sizeof_siginfo_t (void) -{ - return sizeof(siginfo_t); -} -#endif - -INLINE int -__hscore_f_getfl( void ) -{ -#ifdef F_GETFL - return F_GETFL; -#else - return 0; -#endif -} - -INLINE int -__hscore_f_setfl( void ) -{ -#ifdef F_SETFL - return F_SETFL; -#else - return 0; -#endif -} - -INLINE int -__hscore_f_setfd( void ) -{ -#ifdef F_SETFD - return F_SETFD; -#else - return 0; -#endif -} - -INLINE long -__hscore_fd_cloexec( void ) -{ -#ifdef FD_CLOEXEC - return FD_CLOEXEC; -#else - return 0; -#endif -} - -// defined in rts/RtsStartup.c. -extern void* __hscore_get_saved_termios(int fd); -extern void __hscore_set_saved_termios(int fd, void* ts); - -#ifdef __MINGW32__ -INLINE int __hscore_open(wchar_t *file, int how, mode_t mode) { - if ((how & O_WRONLY) || (how & O_RDWR) || (how & O_APPEND)) - return _wsopen(file,how | _O_NOINHERIT,_SH_DENYNO,mode); - // _O_NOINHERIT: see #2650 - else - return _wsopen(file,how | _O_NOINHERIT,_SH_DENYNO,mode); - // _O_NOINHERIT: see #2650 -} -#else -INLINE int __hscore_open(char *file, int how, mode_t mode) { - return open(file,how,mode); -} -#endif - -#if darwin_HOST_OS -// You should not access _environ directly on Darwin in a bundle/shared library. -// See #2458 and http://developer.apple.com/library/mac/#documentation/Darwin/Reference/ManPages/man7/environ.7.html -#include -INLINE char **__hscore_environ(void) { return *(_NSGetEnviron()); } -#else -/* ToDo: write a feature test that doesn't assume 'environ' to - * be in scope at link-time. */ -extern char** environ; -INLINE char **__hscore_environ(void) { return environ; } -#endif - -/* lossless conversions between pointers and integral types */ -INLINE void * __hscore_from_uintptr(uintptr_t n) { return (void *)n; } -INLINE void * __hscore_from_intptr (intptr_t n) { return (void *)n; } -INLINE uintptr_t __hscore_to_uintptr (void *p) { return (uintptr_t)p; } -INLINE intptr_t __hscore_to_intptr (void *p) { return (intptr_t)p; } - -void errorBelch2(const char*s, char *t); -void debugBelch2(const char*s, char *t); - -#endif /* __HSBASE_H__ */ - diff --git a/libraries/base-4.7.0.0/include/HsBaseConfig.h b/libraries/base-4.7.0.0/include/HsBaseConfig.h deleted file mode 100644 index 8b205b0..0000000 --- a/libraries/base-4.7.0.0/include/HsBaseConfig.h +++ /dev/null @@ -1,616 +0,0 @@ -/* include/HsBaseConfig.h. Generated from HsBaseConfig.h.in by configure. */ -/* include/HsBaseConfig.h.in. Generated from configure.ac by autoheader. */ - -/* The value of E2BIG. */ -#define CONST_E2BIG 7 - -/* The value of EACCES. */ -#define CONST_EACCES 13 - -/* The value of EADDRINUSE. */ -#define CONST_EADDRINUSE 98 - -/* The value of EADDRNOTAVAIL. */ -#define CONST_EADDRNOTAVAIL 99 - -/* The value of EADV. */ -#define CONST_EADV 68 - -/* The value of EAFNOSUPPORT. */ -#define CONST_EAFNOSUPPORT 97 - -/* The value of EAGAIN. */ -#define CONST_EAGAIN 11 - -/* The value of EALREADY. */ -#define CONST_EALREADY 114 - -/* The value of EBADF. */ -#define CONST_EBADF 9 - -/* The value of EBADMSG. */ -#define CONST_EBADMSG 74 - -/* The value of EBADRPC. */ -#define CONST_EBADRPC -1 - -/* The value of EBUSY. */ -#define CONST_EBUSY 16 - -/* The value of ECHILD. */ -#define CONST_ECHILD 10 - -/* The value of ECOMM. */ -#define CONST_ECOMM 70 - -/* The value of ECONNABORTED. */ -#define CONST_ECONNABORTED 103 - -/* The value of ECONNREFUSED. */ -#define CONST_ECONNREFUSED 111 - -/* The value of ECONNRESET. */ -#define CONST_ECONNRESET 104 - -/* The value of EDEADLK. */ -#define CONST_EDEADLK 35 - -/* The value of EDESTADDRREQ. */ -#define CONST_EDESTADDRREQ 89 - -/* The value of EDIRTY. */ -#define CONST_EDIRTY -1 - -/* The value of EDOM. */ -#define CONST_EDOM 33 - -/* The value of EDQUOT. */ -#define CONST_EDQUOT 122 - -/* The value of EEXIST. */ -#define CONST_EEXIST 17 - -/* The value of EFAULT. */ -#define CONST_EFAULT 14 - -/* The value of EFBIG. */ -#define CONST_EFBIG 27 - -/* The value of EFTYPE. */ -#define CONST_EFTYPE -1 - -/* The value of EHOSTDOWN. */ -#define CONST_EHOSTDOWN 112 - -/* The value of EHOSTUNREACH. */ -#define CONST_EHOSTUNREACH 113 - -/* The value of EIDRM. */ -#define CONST_EIDRM 43 - -/* The value of EILSEQ. */ -#define CONST_EILSEQ 84 - -/* The value of EINPROGRESS. */ -#define CONST_EINPROGRESS 115 - -/* The value of EINTR. */ -#define CONST_EINTR 4 - -/* The value of EINVAL. */ -#define CONST_EINVAL 22 - -/* The value of EIO. */ -#define CONST_EIO 5 - -/* The value of EISCONN. */ -#define CONST_EISCONN 106 - -/* The value of EISDIR. */ -#define CONST_EISDIR 21 - -/* The value of ELOOP. */ -#define CONST_ELOOP 40 - -/* The value of EMFILE. */ -#define CONST_EMFILE 24 - -/* The value of EMLINK. */ -#define CONST_EMLINK 31 - -/* The value of EMSGSIZE. */ -#define CONST_EMSGSIZE 90 - -/* The value of EMULTIHOP. */ -#define CONST_EMULTIHOP 72 - -/* The value of ENAMETOOLONG. */ -#define CONST_ENAMETOOLONG 36 - -/* The value of ENETDOWN. */ -#define CONST_ENETDOWN 100 - -/* The value of ENETRESET. */ -#define CONST_ENETRESET 102 - -/* The value of ENETUNREACH. */ -#define CONST_ENETUNREACH 101 - -/* The value of ENFILE. */ -#define CONST_ENFILE 23 - -/* The value of ENOBUFS. */ -#define CONST_ENOBUFS 105 - -/* The value of ENOCIGAR. */ -#define CONST_ENOCIGAR -1 - -/* The value of ENODATA. */ -#define CONST_ENODATA 61 - -/* The value of ENODEV. */ -#define CONST_ENODEV 19 - -/* The value of ENOENT. */ -#define CONST_ENOENT 2 - -/* The value of ENOEXEC. */ -#define CONST_ENOEXEC 8 - -/* The value of ENOLCK. */ -#define CONST_ENOLCK 37 - -/* The value of ENOLINK. */ -#define CONST_ENOLINK 67 - -/* The value of ENOMEM. */ -#define CONST_ENOMEM 12 - -/* The value of ENOMSG. */ -#define CONST_ENOMSG 42 - -/* The value of ENONET. */ -#define CONST_ENONET 64 - -/* The value of ENOPROTOOPT. */ -#define CONST_ENOPROTOOPT 92 - -/* The value of ENOSPC. */ -#define CONST_ENOSPC 28 - -/* The value of ENOSR. */ -#define CONST_ENOSR 63 - -/* The value of ENOSTR. */ -#define CONST_ENOSTR 60 - -/* The value of ENOSYS. */ -#define CONST_ENOSYS 38 - -/* The value of ENOTBLK. */ -#define CONST_ENOTBLK 15 - -/* The value of ENOTCONN. */ -#define CONST_ENOTCONN 107 - -/* The value of ENOTDIR. */ -#define CONST_ENOTDIR 20 - -/* The value of ENOTEMPTY. */ -#define CONST_ENOTEMPTY 39 - -/* The value of ENOTSOCK. */ -#define CONST_ENOTSOCK 88 - -/* The value of ENOTTY. */ -#define CONST_ENOTTY 25 - -/* The value of ENXIO. */ -#define CONST_ENXIO 6 - -/* The value of EOPNOTSUPP. */ -#define CONST_EOPNOTSUPP 95 - -/* The value of EPERM. */ -#define CONST_EPERM 1 - -/* The value of EPFNOSUPPORT. */ -#define CONST_EPFNOSUPPORT 96 - -/* The value of EPIPE. */ -#define CONST_EPIPE 32 - -/* The value of EPROCLIM. */ -#define CONST_EPROCLIM -1 - -/* The value of EPROCUNAVAIL. */ -#define CONST_EPROCUNAVAIL -1 - -/* The value of EPROGMISMATCH. */ -#define CONST_EPROGMISMATCH -1 - -/* The value of EPROGUNAVAIL. */ -#define CONST_EPROGUNAVAIL -1 - -/* The value of EPROTO. */ -#define CONST_EPROTO 71 - -/* The value of EPROTONOSUPPORT. */ -#define CONST_EPROTONOSUPPORT 93 - -/* The value of EPROTOTYPE. */ -#define CONST_EPROTOTYPE 91 - -/* The value of ERANGE. */ -#define CONST_ERANGE 34 - -/* The value of EREMCHG. */ -#define CONST_EREMCHG 78 - -/* The value of EREMOTE. */ -#define CONST_EREMOTE 66 - -/* The value of EROFS. */ -#define CONST_EROFS 30 - -/* The value of ERPCMISMATCH. */ -#define CONST_ERPCMISMATCH -1 - -/* The value of ERREMOTE. */ -#define CONST_ERREMOTE -1 - -/* The value of ESHUTDOWN. */ -#define CONST_ESHUTDOWN 108 - -/* The value of ESOCKTNOSUPPORT. */ -#define CONST_ESOCKTNOSUPPORT 94 - -/* The value of ESPIPE. */ -#define CONST_ESPIPE 29 - -/* The value of ESRCH. */ -#define CONST_ESRCH 3 - -/* The value of ESRMNT. */ -#define CONST_ESRMNT 69 - -/* The value of ESTALE. */ -#define CONST_ESTALE 116 - -/* The value of ETIME. */ -#define CONST_ETIME 62 - -/* The value of ETIMEDOUT. */ -#define CONST_ETIMEDOUT 110 - -/* The value of ETOOMANYREFS. */ -#define CONST_ETOOMANYREFS 109 - -/* The value of ETXTBSY. */ -#define CONST_ETXTBSY 26 - -/* The value of EUSERS. */ -#define CONST_EUSERS 87 - -/* The value of EWOULDBLOCK. */ -#define CONST_EWOULDBLOCK 11 - -/* The value of EXDEV. */ -#define CONST_EXDEV 18 - -/* The value of O_BINARY. */ -#define CONST_O_BINARY 0 - -/* The value of SIGINT. */ -#define CONST_SIGINT 2 - -/* Define to 1 if you have the `clock_gettime' function. */ -#define HAVE_CLOCK_GETTIME 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_CTYPE_H 1 - -/* Define if you have epoll support. */ -#define HAVE_EPOLL 1 - -/* Define to 1 if you have the `epoll_ctl' function. */ -#define HAVE_EPOLL_CTL 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_ERRNO_H 1 - -/* Define to 1 if you have the `eventfd' function. */ -#define HAVE_EVENTFD 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_FCNTL_H 1 - -/* Define to 1 if you have the `ftruncate' function. */ -#define HAVE_FTRUNCATE 1 - -/* Define to 1 if you have the `getclock' function. */ -/* #undef HAVE_GETCLOCK */ - -/* Define to 1 if you have the `getrusage' function. */ -#define HAVE_GETRUSAGE 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_INTTYPES_H 1 - -/* Define to 1 if you have the `iswspace' function. */ -#define HAVE_ISWSPACE 1 - -/* Define to 1 if you have the `kevent' function. */ -/* #undef HAVE_KEVENT */ - -/* Define to 1 if you have the `kevent64' function. */ -/* #undef HAVE_KEVENT64 */ - -/* Define if you have kqueue support. */ -/* #undef HAVE_KQUEUE */ - -/* Define to 1 if you have the header file. */ -#define HAVE_LANGINFO_H 1 - -/* Define to 1 if you have libcharset. */ -/* #undef HAVE_LIBCHARSET */ - -/* Define to 1 if you have the `rt' library (-lrt). */ -#define HAVE_LIBRT 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_LIMITS_H 1 - -/* Define to 1 if the system has the type `long long'. */ -#define HAVE_LONG_LONG 1 - -/* Define to 1 if you have the `lstat' function. */ -#define HAVE_LSTAT 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_MEMORY_H 1 - -/* Define if you have poll support. */ -#define HAVE_POLL 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_POLL_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_SIGNAL_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_STDINT_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_STDLIB_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_STRINGS_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_STRING_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_SYS_EPOLL_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_SYS_EVENTFD_H 1 - -/* Define to 1 if you have the header file. */ -/* #undef HAVE_SYS_EVENT_H */ - -/* Define to 1 if you have the header file. */ -#define HAVE_SYS_RESOURCE_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_SYS_SELECT_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_SYS_STAT_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_SYS_SYSCALL_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_SYS_TIMEB_H 1 - -/* Define to 1 if you have the header file. */ -/* #undef HAVE_SYS_TIMERS_H */ - -/* Define to 1 if you have the header file. */ -#define HAVE_SYS_TIMES_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_SYS_TIME_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_SYS_TYPES_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_SYS_UTSNAME_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_SYS_WAIT_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_TERMIOS_H 1 - -/* Define to 1 if you have the `times' function. */ -#define HAVE_TIMES 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_TIME_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_UNISTD_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_UTIME_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_WCTYPE_H 1 - -/* Define to 1 if you have the header file. */ -/* #undef HAVE_WINDOWS_H */ - -/* Define to 1 if you have the header file. */ -/* #undef HAVE_WINSOCK_H */ - -/* Define to 1 if you have the `_chsize' function. */ -/* #undef HAVE__CHSIZE */ - -/* Define to Haskell type for cc_t */ -#define HTYPE_CC_T Word8 - -/* Define to Haskell type for char */ -#define HTYPE_CHAR Int8 - -/* Define to Haskell type for clock_t */ -#define HTYPE_CLOCK_T Int64 - -/* Define to Haskell type for dev_t */ -#define HTYPE_DEV_T Word64 - -/* Define to Haskell type for double */ -#define HTYPE_DOUBLE Double - -/* Define to Haskell type for float */ -#define HTYPE_FLOAT Float - -/* Define to Haskell type for gid_t */ -#define HTYPE_GID_T Word32 - -/* Define to Haskell type for ino_t */ -#define HTYPE_INO_T Word64 - -/* Define to Haskell type for int */ -#define HTYPE_INT Int32 - -/* Define to Haskell type for intmax_t */ -#define HTYPE_INTMAX_T Int64 - -/* Define to Haskell type for intptr_t */ -#define HTYPE_INTPTR_T Int64 - -/* Define to Haskell type for long */ -#define HTYPE_LONG Int64 - -/* Define to Haskell type for long long */ -#define HTYPE_LONG_LONG Int64 - -/* Define to Haskell type for mode_t */ -#define HTYPE_MODE_T Word32 - -/* Define to Haskell type for nlink_t */ -#define HTYPE_NLINK_T Word64 - -/* Define to Haskell type for off_t */ -#define HTYPE_OFF_T Int64 - -/* Define to Haskell type for pid_t */ -#define HTYPE_PID_T Int32 - -/* Define to Haskell type for ptrdiff_t */ -#define HTYPE_PTRDIFF_T Int64 - -/* Define to Haskell type for rlim_t */ -#define HTYPE_RLIM_T Word64 - -/* Define to Haskell type for short */ -#define HTYPE_SHORT Int16 - -/* Define to Haskell type for signed char */ -#define HTYPE_SIGNED_CHAR Int8 - -/* Define to Haskell type for sig_atomic_t */ -#define HTYPE_SIG_ATOMIC_T Int32 - -/* Define to Haskell type for size_t */ -#define HTYPE_SIZE_T Word64 - -/* Define to Haskell type for speed_t */ -#define HTYPE_SPEED_T Word32 - -/* Define to Haskell type for ssize_t */ -#define HTYPE_SSIZE_T Int64 - -/* Define to Haskell type for suseconds_t */ -#define HTYPE_SUSECONDS_T Int64 - -/* Define to Haskell type for tcflag_t */ -#define HTYPE_TCFLAG_T Word32 - -/* Define to Haskell type for time_t */ -#define HTYPE_TIME_T Int64 - -/* Define to Haskell type for uid_t */ -#define HTYPE_UID_T Word32 - -/* Define to Haskell type for uintmax_t */ -#define HTYPE_UINTMAX_T Word64 - -/* Define to Haskell type for uintptr_t */ -#define HTYPE_UINTPTR_T Word64 - -/* Define to Haskell type for unsigned char */ -#define HTYPE_UNSIGNED_CHAR Word8 - -/* Define to Haskell type for unsigned int */ -#define HTYPE_UNSIGNED_INT Word32 - -/* Define to Haskell type for unsigned long */ -#define HTYPE_UNSIGNED_LONG Word64 - -/* Define to Haskell type for unsigned long long */ -#define HTYPE_UNSIGNED_LONG_LONG Word64 - -/* Define to Haskell type for unsigned short */ -#define HTYPE_UNSIGNED_SHORT Word16 - -/* Define to Haskell type for useconds_t */ -#define HTYPE_USECONDS_T Word32 - -/* Define to Haskell type for wchar_t */ -#define HTYPE_WCHAR_T Int32 - -/* Define to the address where bug reports for this package should be sent. */ -#define PACKAGE_BUGREPORT "libraries@haskell.org" - -/* Define to the full name of this package. */ -#define PACKAGE_NAME "Haskell base package" - -/* Define to the full name and version of this package. */ -#define PACKAGE_STRING "Haskell base package 1.0" - -/* Define to the one symbol short name of this package. */ -#define PACKAGE_TARNAME "base" - -/* Define to the home page for this package. */ -#define PACKAGE_URL "" - -/* Define to the version of this package. */ -#define PACKAGE_VERSION "1.0" - -/* The size of `kev.filter', as computed by sizeof. */ -/* #undef SIZEOF_KEV_FILTER */ - -/* The size of `kev.flags', as computed by sizeof. */ -/* #undef SIZEOF_KEV_FLAGS */ - -/* The size of `struct MD5Context', as computed by sizeof. */ -#define SIZEOF_STRUCT_MD5CONTEXT 88 - -/* Define to 1 if you have the ANSI C header files. */ -#define STDC_HEADERS 1 - -/* Enable large inode numbers on Mac OS X 10.5. */ -#ifndef _DARWIN_USE_64_BIT_INODE -# define _DARWIN_USE_64_BIT_INODE 1 -#endif - -/* Number of bits in a file offset, on hosts where this is settable. */ -/* #undef _FILE_OFFSET_BITS */ - -/* Define for large files, on AIX-style hosts. */ -/* #undef _LARGE_FILES */ diff --git a/libraries/base-4.7.0.0/include/OldTypeable.h b/libraries/base-4.7.0.0/include/OldTypeable.h deleted file mode 100644 index 38fe90f..0000000 --- a/libraries/base-4.7.0.0/include/OldTypeable.h +++ /dev/null @@ -1,123 +0,0 @@ -{- -------------------------------------------------------------------------- -// Macros to help make Typeable instances. -// -// INSTANCE_TYPEABLEn(tc,tcname,"tc") defines -// -// instance Typeable/n/ tc -// instance Typeable a => Typeable/n-1/ (tc a) -// instance (Typeable a, Typeable b) => Typeable/n-2/ (tc a b) -// ... -// instance (Typeable a1, ..., Typeable an) => Typeable (tc a1 ... an) -// -------------------------------------------------------------------------- --} - -#ifndef TYPEABLE_H -#define TYPEABLE_H - -#ifdef __GLASGOW_HASKELL__ - --- // For GHC, we can use DeriveDataTypeable + StandaloneDeriving to --- // generate the instances. - -#define INSTANCE_TYPEABLE0(tycon,tcname,str) deriving instance Typeable tycon -#define INSTANCE_TYPEABLE1(tycon,tcname,str) deriving instance Typeable1 tycon -#define INSTANCE_TYPEABLE2(tycon,tcname,str) deriving instance Typeable2 tycon -#define INSTANCE_TYPEABLE3(tycon,tcname,str) deriving instance Typeable3 tycon -#define INSTANCE_TYPEABLE4(tycon,tcname,str) deriving instance Typeable4 tycon -#define INSTANCE_TYPEABLE5(tycon,tcname,str) deriving instance Typeable5 tycon -#define INSTANCE_TYPEABLE6(tycon,tcname,str) deriving instance Typeable6 tycon -#define INSTANCE_TYPEABLE7(tycon,tcname,str) deriving instance Typeable7 tycon - -#else /* !__GLASGOW_HASKELL__ */ - -#define INSTANCE_TYPEABLE0(tycon,tcname,str) \ -tcname :: TyCon; \ -tcname = mkTyCon str; \ -instance Typeable tycon where { typeOf _ = mkTyConApp tcname [] } - -#define INSTANCE_TYPEABLE1(tycon,tcname,str) \ -tcname = mkTyCon str; \ -instance Typeable1 tycon where { typeOf1 _ = mkTyConApp tcname [] }; \ -instance Typeable a => Typeable (tycon a) where { typeOf = typeOfDefault } - -#define INSTANCE_TYPEABLE2(tycon,tcname,str) \ -tcname = mkTyCon str; \ -instance Typeable2 tycon where { typeOf2 _ = mkTyConApp tcname [] }; \ -instance Typeable a => Typeable1 (tycon a) where { \ - typeOf1 = typeOf1Default }; \ -instance (Typeable a, Typeable b) => Typeable (tycon a b) where { \ - typeOf = typeOfDefault } - -#define INSTANCE_TYPEABLE3(tycon,tcname,str) \ -tcname = mkTyCon str; \ -instance Typeable3 tycon where { typeOf3 _ = mkTyConApp tcname [] }; \ -instance Typeable a => Typeable2 (tycon a) where { \ - typeOf2 = typeOf2Default }; \ -instance (Typeable a, Typeable b) => Typeable1 (tycon a b) where { \ - typeOf1 = typeOf1Default }; \ -instance (Typeable a, Typeable b, Typeable c) => Typeable (tycon a b c) where { \ - typeOf = typeOfDefault } - -#define INSTANCE_TYPEABLE4(tycon,tcname,str) \ -tcname = mkTyCon str; \ -instance Typeable4 tycon where { typeOf4 _ = mkTyConApp tcname [] }; \ -instance Typeable a => Typeable3 (tycon a) where { \ - typeOf3 = typeOf3Default }; \ -instance (Typeable a, Typeable b) => Typeable2 (tycon a b) where { \ - typeOf2 = typeOf2Default }; \ -instance (Typeable a, Typeable b, Typeable c) => Typeable1 (tycon a b c) where { \ - typeOf1 = typeOf1Default }; \ -instance (Typeable a, Typeable b, Typeable c, Typeable d) => Typeable (tycon a b c d) where { \ - typeOf = typeOfDefault } - -#define INSTANCE_TYPEABLE5(tycon,tcname,str) \ -tcname = mkTyCon str; \ -instance Typeable5 tycon where { typeOf5 _ = mkTyConApp tcname [] }; \ -instance Typeable a => Typeable4 (tycon a) where { \ - typeOf4 = typeOf4Default }; \ -instance (Typeable a, Typeable b) => Typeable3 (tycon a b) where { \ - typeOf3 = typeOf3Default }; \ -instance (Typeable a, Typeable b, Typeable c) => Typeable2 (tycon a b c) where { \ - typeOf2 = typeOf2Default }; \ -instance (Typeable a, Typeable b, Typeable c, Typeable d) => Typeable1 (tycon a b c d) where { \ - typeOf1 = typeOf1Default }; \ -instance (Typeable a, Typeable b, Typeable c, Typeable d, Typeable e) => Typeable (tycon a b c d e) where { \ - typeOf = typeOfDefault } - -#define INSTANCE_TYPEABLE6(tycon,tcname,str) \ -tcname = mkTyCon str; \ -instance Typeable6 tycon where { typeOf6 _ = mkTyConApp tcname [] }; \ -instance Typeable a => Typeable5 (tycon a) where { \ - typeOf5 = typeOf5Default }; \ -instance (Typeable a, Typeable b) => Typeable4 (tycon a b) where { \ - typeOf4 = typeOf4Default }; \ -instance (Typeable a, Typeable b, Typeable c) => Typeable3 (tycon a b c) where { \ - typeOf3 = typeOf3Default }; \ -instance (Typeable a, Typeable b, Typeable c, Typeable d) => Typeable2 (tycon a b c d) where { \ - typeOf2 = typeOf2Default }; \ -instance (Typeable a, Typeable b, Typeable c, Typeable d, Typeable e) => Typeable1 (tycon a b c d e) where { \ - typeOf1 = typeOf1Default }; \ -instance (Typeable a, Typeable b, Typeable c, Typeable d, Typeable e, Typeable f) => Typeable (tycon a b c d e f) where { \ - typeOf = typeOfDefault } - -#define INSTANCE_TYPEABLE7(tycon,tcname,str) \ -tcname = mkTyCon str; \ -instance Typeable7 tycon where { typeOf7 _ = mkTyConApp tcname [] }; \ -instance Typeable a => Typeable6 (tycon a) where { \ - typeOf6 = typeOf6Default }; \ -instance (Typeable a, Typeable b) => Typeable5 (tycon a b) where { \ - typeOf5 = typeOf5Default }; \ -instance (Typeable a, Typeable b, Typeable c) => Typeable4 (tycon a b c) where { \ - typeOf4 = typeOf4Default }; \ -instance (Typeable a, Typeable b, Typeable c, Typeable d) => Typeable3 (tycon a b c d) where { \ - typeOf3 = typeOf3Default }; \ -instance (Typeable a, Typeable b, Typeable c, Typeable d, Typeable e) => Typeable2 (tycon a b c d e) where { \ - typeOf2 = typeOf2Default }; \ -instance (Typeable a, Typeable b, Typeable c, Typeable d, Typeable e, Typeable f) => Typeable1 (tycon a b c d e f) where { \ - typeOf1 = typeOf1Default }; \ -instance (Typeable a, Typeable b, Typeable c, Typeable d, Typeable e, Typeable f, Typeable g) => Typeable (tycon a b c d e f g) where { \ - typeOf = typeOfDefault } - -#endif /* !__GLASGOW_HASKELL__ */ - -#endif diff --git a/libraries/base-4.7.0.0/include/Typeable.h b/libraries/base-4.7.0.0/include/Typeable.h deleted file mode 100644 index f8ea998..0000000 --- a/libraries/base-4.7.0.0/include/Typeable.h +++ /dev/null @@ -1,123 +0,0 @@ -{- -------------------------------------------------------------------------- -// Macros to help make Typeable instances. -// -// INSTANCE_TYPEABLEn(tc,tcname,"tc") defines -// -// instance Typeable/n/ tc -// instance Typeable a => Typeable/n-1/ (tc a) -// instance (Typeable a, Typeable b) => Typeable/n-2/ (tc a b) -// ... -// instance (Typeable a1, ..., Typeable an) => Typeable (tc a1 ... an) -// -------------------------------------------------------------------------- --} - -#ifndef TYPEABLE_H -#define TYPEABLE_H - -#ifdef __GLASGOW_HASKELL__ - --- // For GHC, we can use DeriveDataTypeable + StandaloneDeriving to --- // generate the instances. - -#define INSTANCE_TYPEABLE0(tycon,tcname,str) deriving instance Typeable tycon -#define INSTANCE_TYPEABLE1(tycon,tcname,str) deriving instance Typeable tycon -#define INSTANCE_TYPEABLE2(tycon,tcname,str) deriving instance Typeable tycon -#define INSTANCE_TYPEABLE3(tycon,tcname,str) deriving instance Typeable tycon -#define INSTANCE_TYPEABLE4(tycon,tcname,str) deriving instance Typeable tycon -#define INSTANCE_TYPEABLE5(tycon,tcname,str) deriving instance Typeable tycon -#define INSTANCE_TYPEABLE6(tycon,tcname,str) deriving instance Typeable tycon -#define INSTANCE_TYPEABLE7(tycon,tcname,str) deriving instance Typeable tycon - -#else /* !__GLASGOW_HASKELL__ */ - -#define INSTANCE_TYPEABLE0(tycon,tcname,str) \ -tcname :: TyCon; \ -tcname = mkTyCon str; \ -instance Typeable tycon where { typeOf _ = mkTyConApp tcname [] } - -#define INSTANCE_TYPEABLE1(tycon,tcname,str) \ -tcname = mkTyCon str; \ -instance Typeable1 tycon where { typeOf1 _ = mkTyConApp tcname [] }; \ -instance Typeable a => Typeable (tycon a) where { typeOf = typeOfDefault } - -#define INSTANCE_TYPEABLE2(tycon,tcname,str) \ -tcname = mkTyCon str; \ -instance Typeable2 tycon where { typeOf2 _ = mkTyConApp tcname [] }; \ -instance Typeable a => Typeable1 (tycon a) where { \ - typeOf1 = typeOf1Default }; \ -instance (Typeable a, Typeable b) => Typeable (tycon a b) where { \ - typeOf = typeOfDefault } - -#define INSTANCE_TYPEABLE3(tycon,tcname,str) \ -tcname = mkTyCon str; \ -instance Typeable3 tycon where { typeOf3 _ = mkTyConApp tcname [] }; \ -instance Typeable a => Typeable2 (tycon a) where { \ - typeOf2 = typeOf2Default }; \ -instance (Typeable a, Typeable b) => Typeable1 (tycon a b) where { \ - typeOf1 = typeOf1Default }; \ -instance (Typeable a, Typeable b, Typeable c) => Typeable (tycon a b c) where { \ - typeOf = typeOfDefault } - -#define INSTANCE_TYPEABLE4(tycon,tcname,str) \ -tcname = mkTyCon str; \ -instance Typeable4 tycon where { typeOf4 _ = mkTyConApp tcname [] }; \ -instance Typeable a => Typeable3 (tycon a) where { \ - typeOf3 = typeOf3Default }; \ -instance (Typeable a, Typeable b) => Typeable2 (tycon a b) where { \ - typeOf2 = typeOf2Default }; \ -instance (Typeable a, Typeable b, Typeable c) => Typeable1 (tycon a b c) where { \ - typeOf1 = typeOf1Default }; \ -instance (Typeable a, Typeable b, Typeable c, Typeable d) => Typeable (tycon a b c d) where { \ - typeOf = typeOfDefault } - -#define INSTANCE_TYPEABLE5(tycon,tcname,str) \ -tcname = mkTyCon str; \ -instance Typeable5 tycon where { typeOf5 _ = mkTyConApp tcname [] }; \ -instance Typeable a => Typeable4 (tycon a) where { \ - typeOf4 = typeOf4Default }; \ -instance (Typeable a, Typeable b) => Typeable3 (tycon a b) where { \ - typeOf3 = typeOf3Default }; \ -instance (Typeable a, Typeable b, Typeable c) => Typeable2 (tycon a b c) where { \ - typeOf2 = typeOf2Default }; \ -instance (Typeable a, Typeable b, Typeable c, Typeable d) => Typeable1 (tycon a b c d) where { \ - typeOf1 = typeOf1Default }; \ -instance (Typeable a, Typeable b, Typeable c, Typeable d, Typeable e) => Typeable (tycon a b c d e) where { \ - typeOf = typeOfDefault } - -#define INSTANCE_TYPEABLE6(tycon,tcname,str) \ -tcname = mkTyCon str; \ -instance Typeable6 tycon where { typeOf6 _ = mkTyConApp tcname [] }; \ -instance Typeable a => Typeable5 (tycon a) where { \ - typeOf5 = typeOf5Default }; \ -instance (Typeable a, Typeable b) => Typeable4 (tycon a b) where { \ - typeOf4 = typeOf4Default }; \ -instance (Typeable a, Typeable b, Typeable c) => Typeable3 (tycon a b c) where { \ - typeOf3 = typeOf3Default }; \ -instance (Typeable a, Typeable b, Typeable c, Typeable d) => Typeable2 (tycon a b c d) where { \ - typeOf2 = typeOf2Default }; \ -instance (Typeable a, Typeable b, Typeable c, Typeable d, Typeable e) => Typeable1 (tycon a b c d e) where { \ - typeOf1 = typeOf1Default }; \ -instance (Typeable a, Typeable b, Typeable c, Typeable d, Typeable e, Typeable f) => Typeable (tycon a b c d e f) where { \ - typeOf = typeOfDefault } - -#define INSTANCE_TYPEABLE7(tycon,tcname,str) \ -tcname = mkTyCon str; \ -instance Typeable7 tycon where { typeOf7 _ = mkTyConApp tcname [] }; \ -instance Typeable a => Typeable6 (tycon a) where { \ - typeOf6 = typeOf6Default }; \ -instance (Typeable a, Typeable b) => Typeable5 (tycon a b) where { \ - typeOf5 = typeOf5Default }; \ -instance (Typeable a, Typeable b, Typeable c) => Typeable4 (tycon a b c) where { \ - typeOf4 = typeOf4Default }; \ -instance (Typeable a, Typeable b, Typeable c, Typeable d) => Typeable3 (tycon a b c d) where { \ - typeOf3 = typeOf3Default }; \ -instance (Typeable a, Typeable b, Typeable c, Typeable d, Typeable e) => Typeable2 (tycon a b c d e) where { \ - typeOf2 = typeOf2Default }; \ -instance (Typeable a, Typeable b, Typeable c, Typeable d, Typeable e, Typeable f) => Typeable1 (tycon a b c d e f) where { \ - typeOf1 = typeOf1Default }; \ -instance (Typeable a, Typeable b, Typeable c, Typeable d, Typeable e, Typeable f, Typeable g) => Typeable (tycon a b c d e f g) where { \ - typeOf = typeOfDefault } - -#endif /* !__GLASGOW_HASKELL__ */ - -#endif diff --git a/libraries/base-4.7.0.0/include/WCsubst.h b/libraries/base-4.7.0.0/include/WCsubst.h deleted file mode 100644 index f2436dd..0000000 --- a/libraries/base-4.7.0.0/include/WCsubst.h +++ /dev/null @@ -1,24 +0,0 @@ -#ifndef WCSUBST_INCL - -#define WCSUBST_INCL - -#include - -int u_iswupper(int wc); -int u_iswdigit(int wc); -int u_iswalpha(int wc); -int u_iswcntrl(int wc); -int u_iswspace(int wc); -int u_iswprint(int wc); -int u_iswlower(int wc); - -int u_iswalnum(int wc); - -int u_towlower(int wc); -int u_towupper(int wc); -int u_towtitle(int wc); - -int u_gencat(int wc); - -#endif - diff --git a/libraries/base-4.7.0.0/include/consUtils.h b/libraries/base-4.7.0.0/include/consUtils.h deleted file mode 100644 index 588139c..0000000 --- a/libraries/base-4.7.0.0/include/consUtils.h +++ /dev/null @@ -1,13 +0,0 @@ -/* - * (c) The University of Glasgow, 2000-2002 - * - * Win32 Console API helpers. - */ -#ifndef __CONSUTILS_H__ -#define __CONSUTILS_H__ -extern int is_console__(int fd); -extern int set_console_buffering__(int fd, int cooked); -extern int set_console_echo__(int fd, int on); -extern int get_console_echo__(int fd); -extern int flush_input_console__ (int fd); -#endif diff --git a/libraries/packages.db b/libraries/packages.db deleted file mode 100644 index 462e57c..0000000 --- a/libraries/packages.db +++ /dev/null @@ -1 +0,0 @@ -[{"homepage":"","hugs-options":[],"package-url":"","import-dirs":["/home/pschuster/.cabal/lib/x86_64-linux-haskell-names-0.5.1/array-0.4.0.2"],"hs-libraries":["HSarray-0.4.0.2"],"framework-dirs":[],"copyright":"","haddock-interfaces":["/home/pschuster/.cabal/share/doc/x86_64-linux-haskell-names-0.5.1/array-0.4.0.2/html/array.haddock"],"depends":["base-4.7.0.0"],"include-dirs":["/usr/lib/ghc/include"],"category":"Data Structures","exposed":true,"library-dirs":["/home/pschuster/.cabal/lib/x86_64-linux-haskell-names-0.5.1/array-0.4.0.2"],"extra-ghci-libraries":[],"maintainer":"libraries@haskell.org","exposed-modules":["Data.Array","Data.Array.Base","Data.Array.IArray","Data.Array.IO","Data.Array.IO.Safe","Data.Array.IO.Internals","Data.Array.MArray","Data.Array.MArray.Safe","Data.Array.ST","Data.Array.ST.Safe","Data.Array.Storable","Data.Array.Storable.Safe","Data.Array.Storable.Internals","Data.Array.Unboxed","Data.Array.Unsafe"],"name":"array-0.4.0.2","frameworks":[],"includes":[],"synopsis":"Mutable and immutable arrays","stability":"","cc-options":[],"trusted":false,"author":"","id":"array-0.4.0.2","ld-options":[],"license":"BSD3","extra-libraries":[],"hidden-modules":[],"haddock-html":["/home/pschuster/.cabal/share/doc/x86_64-linux-haskell-names-0.5.1/array-0.4.0.2/html"],"description":"This package defines the classes @IArray@ of immutable arrays and\n@MArray@ of arrays mutable within appropriate monads, as well as\nsome instances of these classes."},{"homepage":"","hugs-options":[],"package-url":"","import-dirs":["/home/pschuster/.cabal/lib/x86_64-linux-haskell-names-0.5.1/base-4.7.0.0"],"hs-libraries":["HSbase-4.7.0.0"],"framework-dirs":[],"copyright":"","haddock-interfaces":["/home/pschuster/.cabal/share/doc/x86_64-linux-haskell-names-0.5.1/base-4.7.0.0/html/base.haddock"],"depends":["ghc-prim-0.3.1.0","integer-simple-0.1.1.0"],"include-dirs":["/usr/lib/ghc/include","/home/pschuster/.cabal/lib/x86_64-linux-haskell-names-0.5.1/base-4.7.0.0/include"],"category":"","exposed":true,"library-dirs":["/home/pschuster/.cabal/lib/x86_64-linux-haskell-names-0.5.1/base-4.7.0.0"],"extra-ghci-libraries":[],"maintainer":"libraries@haskell.org","exposed-modules":["Foreign.Concurrent","GHC.Arr","GHC.Base","GHC.Char","GHC.Conc","GHC.Conc.IO","GHC.Conc.Signal","GHC.Conc.Sync","GHC.ConsoleHandler","GHC.Constants","GHC.Desugar","GHC.Enum","GHC.Environment","GHC.Err","GHC.Exception","GHC.Exts","GHC.Fingerprint","GHC.Fingerprint.Type","GHC.Float","GHC.Float.ConversionUtils","GHC.Float.RealFracMethods","GHC.Foreign","GHC.ForeignPtr","GHC.Generics","GHC.GHCi","GHC.IO","GHC.IO.Buffer","GHC.IO.BufferedIO","GHC.IO.Device","GHC.IO.Encoding","GHC.IO.Encoding.CodePage","GHC.IO.Encoding.Failure","GHC.IO.Encoding.Iconv","GHC.IO.Encoding.Latin1","GHC.IO.Encoding.Types","GHC.IO.Encoding.UTF16","GHC.IO.Encoding.UTF32","GHC.IO.Encoding.UTF8","GHC.IO.Exception","GHC.IO.FD","GHC.IO.Handle","GHC.IO.Handle.FD","GHC.IO.Handle.Internals","GHC.IO.Handle.Text","GHC.IO.Handle.Types","GHC.IO.IOMode","GHC.IOArray","GHC.IORef","GHC.IP","GHC.Int","GHC.List","GHC.MVar","GHC.Num","GHC.PArr","GHC.Pack","GHC.Profiling","GHC.Ptr","GHC.Read","GHC.Real","GHC.ST","GHC.Stack","GHC.Stats","GHC.Show","GHC.Stable","GHC.Storable","GHC.STRef","GHC.TypeLits","GHC.TopHandler","GHC.Unicode","GHC.Weak","GHC.Word","System.Timeout","Control.Applicative","Control.Arrow","Control.Category","Control.Concurrent","Control.Concurrent.Chan","Control.Concurrent.MVar","Control.Concurrent.QSem","Control.Concurrent.QSemN","Control.Exception","Control.Exception.Base","Control.Monad","Control.Monad.Fix","Control.Monad.Instances","Control.Monad.ST","Control.Monad.ST.Safe","Control.Monad.ST.Unsafe","Control.Monad.ST.Lazy","Control.Monad.ST.Lazy.Safe","Control.Monad.ST.Lazy.Unsafe","Control.Monad.ST.Strict","Control.Monad.Zip","Data.Bits","Data.Bool","Data.Char","Data.Complex","Data.Dynamic","Data.Either","Data.Eq","Data.Data","Data.Fixed","Data.Foldable","Data.Function","Data.Functor","Data.IORef","Data.Int","Data.Ix","Data.List","Data.Maybe","Data.Monoid","Data.Ord","Data.Ratio","Data.STRef","Data.STRef.Lazy","Data.STRef.Strict","Data.String","Data.Traversable","Data.Tuple","Data.Typeable","Data.Typeable.Internal","Data.OldTypeable","Data.OldTypeable.Internal","Data.Unique","Data.Version","Data.Word","Debug.Trace","Foreign","Foreign.C","Foreign.C.Error","Foreign.C.String","Foreign.C.Types","Foreign.ForeignPtr","Foreign.ForeignPtr.Safe","Foreign.ForeignPtr.Unsafe","Foreign.Marshal","Foreign.Marshal.Alloc","Foreign.Marshal.Array","Foreign.Marshal.Error","Foreign.Marshal.Pool","Foreign.Marshal.Safe","Foreign.Marshal.Utils","Foreign.Marshal.Unsafe","Foreign.Ptr","Foreign.Safe","Foreign.StablePtr","Foreign.Storable","Numeric","Prelude","System.Console.GetOpt","System.CPUTime","System.Environment","System.Exit","System.IO","System.IO.Error","System.IO.Unsafe","System.Info","System.Mem","System.Mem.StableName","System.Mem.Weak","System.Posix.Internals","System.Posix.Types","Text.ParserCombinators.ReadP","Text.ParserCombinators.ReadPrec","Text.Printf","Text.Read","Text.Read.Lex","Text.Show","Text.Show.Functions","Unsafe.Coerce","GHC.Event"],"name":"base-4.7.0.0","frameworks":[],"includes":["HsBase.h"],"synopsis":"Basic libraries","stability":"","cc-options":[],"trusted":false,"author":"","id":"base-4.7.0.0","ld-options":[],"license":"BSD3","extra-libraries":[],"hidden-modules":["Control.Monad.ST.Imp","Control.Monad.ST.Lazy.Imp","Foreign.ForeignPtr.Imp","System.Environment.ExecutablePath","GHC.Event.Array","GHC.Event.Clock","GHC.Event.Control","GHC.Event.EPoll","GHC.Event.IntMap","GHC.Event.Internal","GHC.Event.KQueue","GHC.Event.Manager","GHC.Event.TimerManager","GHC.Event.PSQ","GHC.Event.Poll","GHC.Event.Thread","GHC.Event.Unique"],"haddock-html":["/home/pschuster/.cabal/share/doc/x86_64-linux-haskell-names-0.5.1/base-4.7.0.0/html"],"description":"This package contains the Prelude and its support libraries,\nand a large collection of useful libraries ranging from data\nstructures to parsing combinators and debugging utilities."},{"homepage":"","hugs-options":[],"package-url":"","import-dirs":["/home/pschuster/.cabal/lib/x86_64-linux-haskell-names-0.5.1/integer-simple-0.1.1.0"],"hs-libraries":["HSinteger-simple-0.1.1.0"],"framework-dirs":[],"copyright":"","haddock-interfaces":["/home/pschuster/.cabal/share/doc/x86_64-linux-haskell-names-0.5.1/integer-simple-0.1.1.0/html/integer-simple.haddock"],"depends":["ghc-prim-0.3.1.0"],"include-dirs":["/usr/lib/ghc/include"],"category":"","exposed":true,"library-dirs":["/home/pschuster/.cabal/lib/x86_64-linux-haskell-names-0.5.1/integer-simple-0.1.1.0"],"extra-ghci-libraries":[],"maintainer":"igloo@earth.li","exposed-modules":["GHC.Integer","GHC.Integer.Simple.Internals","GHC.Integer.Logarithms","GHC.Integer.Logarithms.Internals"],"name":"integer-simple-0.1.1.0","frameworks":[],"includes":[],"synopsis":"Simple Integer library","stability":"","cc-options":[],"trusted":false,"author":"","id":"integer-simple-0.1.1.0","ld-options":[],"license":"BSD3","extra-libraries":[],"hidden-modules":["GHC.Integer.Type"],"haddock-html":["/home/pschuster/.cabal/share/doc/x86_64-linux-haskell-names-0.5.1/integer-simple-0.1.1.0/html"],"description":"This package contains an simple Integer library."},{"homepage":"","hugs-options":[],"package-url":"","import-dirs":["/home/pschuster/.cabal/lib/x86_64-linux-haskell-names-0.5.1/ghc-prim-0.3.1.0"],"hs-libraries":["HSghc-prim-0.3.1.0"],"framework-dirs":[],"copyright":"","haddock-interfaces":["/home/pschuster/.cabal/share/doc/x86_64-linux-haskell-names-0.5.1/ghc-prim-0.3.1.0/html/ghc-prim.haddock"],"depends":[],"include-dirs":["/usr/lib/ghc/include"],"category":"","exposed":true,"library-dirs":["/home/pschuster/.cabal/lib/x86_64-linux-haskell-names-0.5.1/ghc-prim-0.3.1.0"],"extra-ghci-libraries":[],"maintainer":"libraries@haskell.org","exposed-modules":["GHC.Classes","GHC.CString","GHC.Debug","GHC.Magic","GHC.PrimopWrappers","GHC.IntWord64","GHC.Tuple","GHC.Types","GHC.Prim"],"name":"ghc-prim-0.3.1.0","frameworks":[],"includes":[],"synopsis":"GHC primitives","stability":"","cc-options":[],"trusted":false,"author":"","id":"ghc-prim-0.3.1.0","ld-options":[],"license":"BSD3","extra-libraries":[],"hidden-modules":[],"haddock-html":["/home/pschuster/.cabal/share/doc/x86_64-linux-haskell-names-0.5.1/ghc-prim-0.3.1.0/html"],"description":"GHC primitives."}] \ No newline at end of file diff --git a/src/Language/Haskell/Names.hs b/src/Language/Haskell/Names.hs index aa119c3..d8d4063 100644 --- a/src/Language/Haskell/Names.hs +++ b/src/Language/Haskell/Names.hs @@ -1,14 +1,18 @@ module Language.Haskell.Names ( - -- * Core functions - computeInterfaces - , getInterfaces - , annotateModule + -- * Functions + resolve + , annotate -- * Types + , Environment , Symbol(..) , Scoped(..) , NameInfo(..) , Error(..) + -- * Reading and writing environments + , readSymbols + , writeSymbols + , loadBase -- * Pretty printing , ppError , ppSymbol @@ -16,3 +20,5 @@ module Language.Haskell.Names import Language.Haskell.Names.Types import Language.Haskell.Names.Recursive +import Language.Haskell.Names.Environment + diff --git a/src/Language/Haskell/Names/Annotated.hs b/src/Language/Haskell/Names/Annotated.hs index a5e1126..7dd973c 100644 --- a/src/Language/Haskell/Names/Annotated.hs +++ b/src/Language/Haskell/Names/Annotated.hs @@ -2,37 +2,38 @@ -- ("Language.Haskell.Names.Open") to annotate the AST with binding -- information. {-# LANGUAGE FlexibleContexts, MultiParamTypeClasses, ImplicitParams, - UndecidableInstances, OverlappingInstances, ScopedTypeVariables, + UndecidableInstances, ScopedTypeVariables, TypeOperators, GADTs #-} module Language.Haskell.Names.Annotated ( Scoped(..) , NameInfo(..) - , annotate + , annotateDecl ) where + import Language.Haskell.Names.Types import Language.Haskell.Names.RecordWildcards import Language.Haskell.Names.Open.Base import Language.Haskell.Names.Open.Instances () import qualified Language.Haskell.Names.GlobalSymbolTable as Global import qualified Language.Haskell.Names.LocalSymbolTable as Local -import Language.Haskell.Names.SyntaxUtils (annName,setAnn,qNameToName) +import Language.Haskell.Names.SyntaxUtils (annName,setAnn) import Language.Haskell.Exts.Annotated.Simplify (sQName) import Language.Haskell.Exts.Annotated +import qualified Language.Haskell.Exts.Syntax as UnAnn import Data.Proxy import Data.Lens.Light -import Data.Typeable (Typeable) +import Data.Typeable ( + Typeable, (:~:)(Refl), eqT) -- in GHC 7.8 Data.Typeable exports (:~:). Be careful to avoid the clash. import Control.Applicative --- This should be incorporated into Data.Typeable soon -import Type.Eq -annotate +annotateDecl :: forall a l . (Resolvable (a (Scoped l)), Functor a, Typeable l) => Scope -> a l -> a (Scoped l) -annotate sc = annotateRec (Proxy :: Proxy l) sc . fmap (Scoped None) +annotateDecl sc = annotateRec (Proxy :: Proxy l) sc . fmap (Scoped None) annotateRec :: forall a l . @@ -42,24 +43,24 @@ annotateRec _ sc a = go sc a where go :: forall a . Resolvable a => Scope -> a -> a go sc a | ReferenceV <- getL nameCtx sc - , Just (Eq :: QName (Scoped l) :~: a) <- dynamicEq + , Just (Refl :: QName (Scoped l) :~: a) <- eqT = lookupValue (fmap sLoc a) sc <$ a | ReferenceT <- getL nameCtx sc - , Just (Eq :: QName (Scoped l) :~: a) <- dynamicEq + , Just (Refl :: QName (Scoped l) :~: a) <- eqT = lookupType (fmap sLoc a) sc <$ a | ReferenceUV <- getL nameCtx sc - , Just (Eq :: Name (Scoped l) :~: a) <- dynamicEq - = lookupValueUnqualifiedAsQualified (fmap sLoc a) sc <$ a + , Just (Refl :: Name (Scoped l) :~: a) <- eqT + = lookupMethod (fmap sLoc a) sc <$ a | ReferenceUT <- getL nameCtx sc - , Just (Eq :: QName (Scoped l) :~: a) <- dynamicEq - = lookupTypeUnqualifiedAsQualified (fmap sLoc a) sc <$ a + , Just (Refl :: QName (Scoped l) :~: a) <- eqT + = lookupAssociatedType (fmap sLoc a) sc <$ a | BindingV <- getL nameCtx sc - , Just (Eq :: Name (Scoped l) :~: a) <- dynamicEq + , Just (Refl :: Name (Scoped l) :~: a) <- eqT = Scoped ValueBinder (sLoc . ann $ a) <$ a | BindingT <- getL nameCtx sc - , Just (Eq :: Name (Scoped l) :~: a) <- dynamicEq + , Just (Refl :: Name (Scoped l) :~: a) <- eqT = Scoped TypeBinder (sLoc . ann $ a) <$ a - | Just (Eq :: FieldUpdate (Scoped l) :~: a) <- dynamicEq + | Just (Refl :: FieldUpdate (Scoped l) :~: a) <- eqT = case a of FieldPun l n -> FieldPun l (lookupValue (sLoc <$> n) sc <$ n) FieldWildcard l -> FieldWildcard (Scoped (RecExpWildcard namesRes) (sLoc l)) where @@ -71,7 +72,7 @@ annotateRec _ sc a = go sc a where Scoped info@(LocalValue _) _ -> return (wcFieldName f,info) _ -> [] _ -> rmap go sc a - | Just (Eq :: PatField (Scoped l) :~: a) <- dynamicEq + | Just (Refl :: PatField (Scoped l) :~: a) <- eqT , PFieldWildcard l <- a = let namesRes = do @@ -106,18 +107,30 @@ lookupType qn sc = Scoped nameInfo (ann qn) Global.Error e -> ScopeError e Global.Special -> None -lookupValueUnqualifiedAsQualified :: Name l -> Scope -> Scoped l -lookupValueUnqualifiedAsQualified n sc = Scoped nameInfo (ann n) +lookupMethod :: Name l -> Scope -> Scoped l +lookupMethod n sc = Scoped nameInfo (ann qn) where - nameInfo = case Global.lookupUnqualifiedAsQualified n $ getL gTable sc of - (Global.SymbolFound r,Just gn) -> GlobalSymbol r gn - (Global.Error e,_) -> ScopeError e - _ -> None + nameInfo = + case Global.lookupMethodOrAssociate qn $ getL gTable sc of + Global.SymbolFound r -> GlobalSymbol r (sQName qn) + Global.Error e -> ScopeError e + Global.Special -> None + qn = qualifyName (getL instQual sc) n + +lookupAssociatedType :: QName l -> Scope -> Scoped l +lookupAssociatedType qn sc = Scoped nameInfo (ann qn) + where + nameInfo = + case Global.lookupMethodOrAssociate qn' $ getL gTable sc of + Global.SymbolFound r -> GlobalSymbol r (sQName qn) + Global.Error e -> ScopeError e + Global.Special -> None + qn' = case qn of + UnQual _ n -> qualifyName (getL instQual sc) n + _ -> qn -lookupTypeUnqualifiedAsQualified :: QName l -> Scope -> Scoped l -lookupTypeUnqualifiedAsQualified qn sc = Scoped nameInfo (ann qn) +qualifyName :: Maybe UnAnn.ModuleName -> Name l -> QName l +qualifyName Nothing n = UnQual (ann n) n +qualifyName (Just (UnAnn.ModuleName moduleName)) n = Qual (ann n) annotatedModuleName n where - nameInfo = case Global.lookupUnqualifiedAsQualified (qNameToName qn) $ getL gTable sc of - (Global.SymbolFound r,Just gn) -> GlobalSymbol r gn - (Global.Error e,_) -> ScopeError e - _ -> None + annotatedModuleName = ModuleName (ann n) moduleName diff --git a/src/Language/Haskell/Names/Environment.hs b/src/Language/Haskell/Names/Environment.hs new file mode 100644 index 0000000..3f53a72 --- /dev/null +++ b/src/Language/Haskell/Names/Environment.hs @@ -0,0 +1,137 @@ +{-# LANGUAGE DeriveDataTypeable, OverloadedStrings, FlexibleInstances #-} +{-# OPTIONS_GHC -fno-warn-orphans -fno-warn-name-shadowing #-} +module Language.Haskell.Names.Environment + ( + Environment + -- * Load a predefined environment + , loadBase + -- * Read and write symbols files + , readSymbols + , writeSymbols + -- * Exceptions + , SymbolsFileException(..) + ) where + +import Language.Haskell.Names.Types (Environment, Symbol(..)) +import Language.Haskell.Exts (ModuleName(ModuleName),prettyPrint,Name) +import Language.Haskell.Names.SyntaxUtils (stringToName,nameToString,annName) +import Language.Haskell.Exts.Annotated.Simplify (sName) +import qualified Data.ByteString.Lazy as BS (readFile, writeFile, pack) +import Data.Aeson +import Data.Monoid +import Data.Char +import Data.Typeable +import Control.Exception +import Control.Applicative +import Control.Monad +import System.FilePath ((), (<.>)) +import qualified Data.Map as Map (fromList) +import Data.Traversable (for) + +import Paths_haskell_names (getDataDir) + +-- | Read symbols from a file. +readSymbols :: FilePath -> IO [Symbol] +readSymbols path = + either (throwIO . BadSymbolsFile path) return =<< + eitherDecode <$> BS.readFile path + +-- | Write symbols to a file. +writeSymbols :: FilePath -> [Symbol] -> IO () +writeSymbols path symbols = + BS.writeFile path $ + encode symbols `mappend` BS.pack [fromIntegral $ ord '\n'] + +data SymbolsFileException = + -- | Symbols could not be parsed. This tells you the name of the file + -- and the parse error text. + BadSymbolsFile FilePath String + deriving (Typeable, Show) +instance Exception SymbolsFileException + +prettyName :: Name -> String +prettyName = nameToString . annName + +instance ToJSON Symbol where + toJSON symbol = + object ([ + "entity" .= symbolEntity symbol, + "module" .= prettyPrint (symbolModule symbol), + "name" .= prettyName (symbolName symbol)] ++ additionalInfo symbol) + where + additionalInfo symbol = case symbol of + Method { className = cls } -> + ["class" .= prettyName cls] + Selector { typeName = ty, constructors = cons } -> + ["type" .= prettyName ty + ,"constructors".= map prettyName cons] + Constructor { typeName = ty } -> + ["type" .= prettyName ty] + TypeFam { associate = as } -> + ["associate" .= fmap prettyName as] + DataFam { associate = as } -> + ["associate" .= fmap prettyName as] + _ -> [] + +symbolEntity :: Symbol -> String +symbolEntity i = case i of + Value {} -> "value" + Method {} -> "method" + Selector {} -> "selector" + Constructor {} -> "constructor" + Type {} -> "type" + Data {} -> "data" + NewType {} -> "newtype" + TypeFam {} -> "typeFamily" + DataFam {} -> "dataFamily" + Class {} -> "class" + +parseName :: String -> Name +parseName = sName . stringToName + +instance FromJSON Symbol where + parseJSON (Object v) = do + entity <- v .: "entity" + symbolmodule <- ModuleName <$> v .: "module" + symbolname <- parseName <$> v .: "name" + + case entity :: String of + "value" -> return $ Value symbolmodule symbolname + "method" -> do + cls <- v .: "class" + return (Method symbolmodule symbolname (parseName cls)) + "selector" -> do + typ <- v .: "type" + cons <- v .: "constructors" + return (Selector symbolmodule symbolname (parseName typ) (map parseName cons)) + "constructor" -> do + typ <- v .: "type" + return (Constructor symbolmodule symbolname (parseName typ)) + "type" -> return $ Type symbolmodule symbolname + "data" -> return $ Data symbolmodule symbolname + "newtype" -> return $ NewType symbolmodule symbolname + "typeFamily" -> do + associate <- fmap parseName <$> v .: "associate" + return $ TypeFam symbolmodule symbolname associate + "dataFamily" -> do + associate <- fmap parseName <$> v .: "associate" + return $ DataFam symbolmodule symbolname associate + "class" -> return $ Class symbolmodule symbolname + _ -> mzero + + parseJSON _ = mzero + + +-- | Load a basic environment that contains modules very similar to GHC's base package. +loadBase :: IO Environment +loadBase = do + moduleSymbols <- for baseModules (\moduleName -> do + dataDir <- getDataDir + let path = dataDir "data" "baseEnvironment" + prettyPrint moduleName <.> "symbols" + symbols <- readSymbols path + return (moduleName, symbols)) + return (Map.fromList moduleSymbols) + +baseModules :: [ModuleName] +baseModules = map ModuleName ["Control.Applicative","Control.Arrow","Control.Category","Control.Concurrent.Chan","Control.Concurrent.MVar","Control.Concurrent.QSem","Control.Concurrent.QSemN","Control.Concurrent","Control.Exception.Base","Control.Exception","Control.Monad.Fix","Control.Monad.Instances","Control.Monad.ST.Imp","Control.Monad.ST.Lazy.Imp","Control.Monad.ST.Lazy.Safe","Control.Monad.ST.Lazy.Unsafe","Control.Monad.ST.Lazy","Control.Monad.ST.Safe","Control.Monad.ST.Strict","Control.Monad.ST.Unsafe","Control.Monad.ST","Control.Monad.Zip","Control.Monad","Data.Bits","Data.Bool","Data.Char","Data.Complex","Data.Data","Data.Dynamic","Data.Either","Data.Eq","Data.Fixed","Data.Foldable","Data.Function","Data.Functor","Data.IORef","Data.Int","Data.Ix","Data.List","Data.Maybe","Data.Monoid","Data.OldTypeable.Internal","Data.OldTypeable","Data.Ord","Data.Ratio","Data.STRef.Lazy","Data.STRef.Strict","Data.STRef","Data.String","Data.Traversable","Data.Tuple","Data.Typeable.Internal","Data.Typeable","Data.Unique","Data.Version","Data.Word","Debug.Trace","Foreign.C.Error","Foreign.C.String","Foreign.C.Types","Foreign.C","Foreign.Concurrent","Foreign.ForeignPtr.Imp","Foreign.ForeignPtr.Safe","Foreign.ForeignPtr.Unsafe","Foreign.ForeignPtr","Foreign.Marshal.Alloc","Foreign.Marshal.Array","Foreign.Marshal.Error","Foreign.Marshal.Pool","Foreign.Marshal.Safe","Foreign.Marshal.Unsafe","Foreign.Marshal.Utils","Foreign.Marshal","Foreign.Ptr","Foreign.Safe","Foreign.StablePtr","Foreign.Storable","Foreign","GHC.Arr","GHC.Base","GHC.Char","GHC.Conc.IO","GHC.Conc.Signal","GHC.Conc.Sync","GHC.Conc","GHC.ConsoleHandler","GHC.Constants","GHC.Desugar","GHC.Enum","GHC.Environment","GHC.Err","GHC.Event.Array","GHC.Event.Clock","GHC.Event.Control","GHC.Event.EPoll","GHC.Event.IntMap","GHC.Event.Internal","GHC.Event.KQueue","GHC.Event.Manager","GHC.Event.PSQ","GHC.Event.Poll","GHC.Event.Thread","GHC.Event.TimerManager","GHC.Event.Unique","GHC.Event","GHC.Exception","GHC.Exts","GHC.Fingerprint.Type","GHC.Fingerprint","GHC.Float.ConversionUtils","GHC.Float.RealFracMethods","GHC.Float","GHC.Foreign","GHC.ForeignPtr","GHC.GHCi","GHC.Generics","GHC.IO.Buffer","GHC.IO.BufferedIO","GHC.IO.Device","GHC.IO.Encoding.CodePage","GHC.IO.Encoding.Failure","GHC.IO.Encoding.Iconv","GHC.IO.Encoding.Latin1","GHC.IO.Encoding.Types","GHC.IO.Encoding.UTF16","GHC.IO.Encoding.UTF32","GHC.IO.Encoding.UTF8","GHC.IO.Encoding","GHC.IO.Exception","GHC.IO.FD","GHC.IO.Handle.FD","GHC.IO.Handle.Internals","GHC.IO.Handle.Text","GHC.IO.Handle.Types","GHC.IO.Handle","GHC.IO.IOMode","GHC.IO","GHC.IOArray","GHC.IORef","GHC.IP","GHC.Int","GHC.List","GHC.MVar","GHC.Num","GHC.PArr","GHC.Pack","GHC.Profiling","GHC.Ptr","GHC.Read","GHC.Real","GHC.ST","GHC.STRef","GHC.Show","GHC.Stable","GHC.Stack","GHC.Stats","GHC.Storable","GHC.TopHandler","GHC.TypeLits","GHC.Unicode","GHC.Weak","GHC.Word","Numeric","Prelude","System.CPUTime","System.Console.GetOpt","System.Environment.ExecutablePath","System.Environment","System.Exit","System.IO.Error","System.IO.Unsafe","System.IO","System.Info","System.Mem.StableName","System.Mem.Weak","System.Mem","System.Posix.Internals","System.Posix.Types","System.Timeout","Text.ParserCombinators.ReadP","Text.ParserCombinators.ReadPrec","Text.Printf","Text.Read.Lex","Text.Read","Text.Show.Functions","Text.Show","Unsafe.Coerce","GHC.CString","GHC.Classes","GHC.Debug","GHC.IntWord64","GHC.Magic","GHC.Prim","GHC.PrimopWrappers","GHC.Tuple","GHC.Types","GHC.Integer.Logarithms.Internals","GHC.Integer.Logarithms","GHC.Integer.Simple.Internals","GHC.Integer.Type","GHC.Integer"] diff --git a/src/Language/Haskell/Names/Exports.hs b/src/Language/Haskell/Names/Exports.hs index db2baaa..0fbfb8d 100644 --- a/src/Language/Haskell/Names/Exports.hs +++ b/src/Language/Haskell/Names/Exports.hs @@ -1,14 +1,15 @@ {-# LANGUAGE TypeFamilies, NoMonoLocalBinds #-} -module Language.Haskell.Names.Exports where +module Language.Haskell.Names.Exports + ( exportedSymbols + , annotateExportSpecList + ) where import qualified Data.Map as Map import qualified Data.Set as Set import Control.Applicative -import Control.Arrow import Control.Monad import Control.Monad.Writer import Data.Data -import Distribution.HaskellSuite.Modules import qualified Language.Haskell.Exts as UnAnn (QName(Qual,UnQual)) import Language.Haskell.Exts.Annotated.Simplify (sQName,sModuleName) import Language.Haskell.Exts.Annotated @@ -19,98 +20,132 @@ import Language.Haskell.Names.ModuleSymbols import Language.Haskell.Names.GlobalSymbolTable as Global import Data.List (nub) -processExports - :: (MonadModule m, ModuleInfo m ~ [Symbol], Data l, Eq l) - => Global.Table - -> Module l - -> m (Maybe (ExportSpecList (Scoped l)), [Symbol]) -processExports tbl m = - case getExportSpecList m of - Nothing -> - return (Nothing, moduleSymbols tbl m) - Just exp -> - liftM (first Just) $ resolveExportSpecList tbl exp -resolveExportSpecList - :: (MonadModule m, ModuleInfo m ~ [Symbol]) - => Global.Table - -> ExportSpecList l - -> m (ExportSpecList (Scoped l), [Symbol]) -resolveExportSpecList tbl (ExportSpecList l specs) = - liftM (first $ ExportSpecList $ none l) $ - runWriterT $ - mapM (WriterT . resolveExportSpec tbl) specs +-- | Compute the list of symbols the given module exports using the given +-- table of symbols that are in scope in that module. +exportedSymbols :: (Data l, Eq l) => Global.Table -> Module l -> [Symbol] +exportedSymbols globalTable modul = case getExportSpecList modul of + Nothing -> moduleSymbols globalTable modul + Just (ExportSpecList _ exportSpecs) -> + concatMap (exportSpecSymbols globalTable) exportSpecs -resolveExportSpec - :: (MonadModule m, ModuleInfo m ~ [Symbol]) - => Global.Table - -> ExportSpec l - -> m (ExportSpec (Scoped l), [Symbol]) -resolveExportSpec tbl exp = - case exp of - EVar l ns@(NoNamespace {}) qn -> return $ - case Global.lookupValue qn tbl of - Global.Error err -> - (scopeError err exp, mempty) - Global.SymbolFound i -> - (EVar (Scoped (Export [i]) l) - (noScope ns) - (Scoped (GlobalSymbol i (sQName qn)) <$> qn), [i]) +exportSpecSymbols :: Global.Table -> ExportSpec l -> [Symbol] +exportSpecSymbols globalTable exportSpec = + case exportSpec of + EVar _ qn -> + case Global.lookupValue qn globalTable of + Global.Error _ -> [] + Global.SymbolFound i -> [i] Global.Special {} -> error "Global.Special in export list?" - EVar _ (TypeNamespace {}) _ -> error "'type' namespace is not supported yet" -- FIXME - EAbs l qn -> return $ - case Global.lookupType qn tbl of - Global.Error err -> - (scopeError err exp, mempty) - Global.SymbolFound i -> - (EAbs (Scoped (Export [i]) l) - (Scoped (GlobalSymbol i (sQName qn)) <$> qn), [i]) + EAbs _ _ qn -> + case Global.lookupType qn globalTable of + Global.Error _ -> [] + Global.SymbolFound i -> [i] Global.Special {} -> error "Global.Special in export list?" - EThingAll l qn -> return $ - case Global.lookupType qn tbl of - Global.Error err -> - (scopeError err exp, mempty) - Global.SymbolFound i -> - let - subs = nub (do - symbol <- concat (Map.elems tbl) - Just n' <- return $ symbolParent symbol - guard (n' == symbolName i) - return symbol) - s = [i] <> subs - in - ( EThingAll (Scoped (Export s) l) (Scoped (GlobalSymbol i (sQName qn)) <$> qn) - , s - ) + EThingAll _ qn -> + case Global.lookupType qn globalTable of + Global.Error _ -> [] + Global.SymbolFound i -> [i] ++ subs where + subs = nub (do + symbol <- concat (Map.elems globalTable) + Just n' <- return $ symbolParent symbol + guard (n' == symbolName i) + return symbol) Global.Special {} -> error "Global.Special in export list?" - EThingWith l qn cns -> return $ - case Global.lookupType qn tbl of - Global.Error err -> - (scopeError err exp, mempty) - Global.SymbolFound i -> - let - (cns', subs) = + EThingWith _ qn cns -> + case Global.lookupType qn globalTable of + Global.Error _ -> [] + Global.SymbolFound i -> [i] ++ subs where + (_, subs) = resolveCNames - (concat (Map.elems tbl)) + (concat (Map.elems globalTable)) (symbolName i) (\cn -> ENotInScope (UnQual (ann cn) (unCName cn))) -- FIXME better error cns - s = [i] <> subs - in - ( EThingWith (Scoped (Export s) l) (Scoped (GlobalSymbol i (sQName qn)) <$> qn) cns' - , s - ) Global.Special {} -> error "Global.Special in export list?" -- FIXME ambiguity check - EModuleContents _ modulename -> return (Scoped (Export exportedSymbols) <$> exp,exportedSymbols) where + EModuleContents _ modulename -> exportedSymbols where - exportedSymbols = Set.toList (Set.intersection inScopeQualified inScopeUnqualified) + exportedSymbols = Set.toList ( + Set.intersection inScopeQualified inScopeUnqualified) inScopeQualified = Set.fromList (do - (UnAnn.Qual prefix _, symbols) <- Map.toList tbl - guard (prefix == (sModuleName modulename)) + (UnAnn.Qual prefix _, symbols) <- Map.toList globalTable + guard (prefix == sModuleName modulename) symbols) inScopeUnqualified = Set.fromList (do - (UnAnn.UnQual _, symbols) <- Map.toList tbl + (UnAnn.UnQual _, symbols) <- Map.toList globalTable symbols) + +-- | Annotate the given export list with scoping information using the given +-- table of symbols that are in scope in that module. +annotateExportSpecList :: Global.Table -> ExportSpecList l -> ExportSpecList (Scoped l) +annotateExportSpecList globalTable (ExportSpecList l exportSpecs) = + ExportSpecList (none l) (map (annotateExportSpec globalTable) exportSpecs) + +annotateExportSpec :: Global.Table -> ExportSpec l -> ExportSpec (Scoped l) +annotateExportSpec globalTable exportSpec = + case exportSpec of + EVar l qn -> + case Global.lookupValue qn globalTable of + Global.Error err -> + scopeError err exportSpec + Global.SymbolFound i -> + EVar (Scoped (Export [i]) l) + (Scoped (GlobalSymbol i (sQName qn)) <$> qn) + Global.Special {} -> error "Global.Special in export list?" + EAbs l ns qn -> + case Global.lookupType qn globalTable of + Global.Error err -> + scopeError err exportSpec + Global.SymbolFound i -> + EAbs (Scoped (Export [i]) l) + (noScope ns) + (Scoped (GlobalSymbol i (sQName qn)) <$> qn) + Global.Special {} -> error "Global.Special in export list?" + EThingAll l qn -> + case Global.lookupType qn globalTable of + Global.Error err -> + scopeError err exportSpec + Global.SymbolFound i -> + let + subs = nub (do + symbol <- concat (Map.elems globalTable) + Just n' <- return $ symbolParent symbol + guard (n' == symbolName i) + return symbol) + s = [i] <> subs + in + EThingAll (Scoped (Export s) l) (Scoped (GlobalSymbol i (sQName qn)) <$> qn) + Global.Special {} -> error "Global.Special in export list?" + EThingWith l qn cns -> + case Global.lookupType qn globalTable of + Global.Error err -> + scopeError err exportSpec + Global.SymbolFound i -> + let + (cns', subs) = + resolveCNames + (concat (Map.elems globalTable)) + (symbolName i) + (\cn -> ENotInScope (UnQual (ann cn) (unCName cn))) -- FIXME better error + cns + s = [i] <> subs + in + EThingWith (Scoped (Export s) l) (Scoped (GlobalSymbol i (sQName qn)) <$> qn) cns' + Global.Special {} -> error "Global.Special in export list?" + -- FIXME ambiguity check + EModuleContents _ modulename -> Scoped (Export exportedSymbols) <$> exportSpec where + + exportedSymbols = Set.toList (Set.intersection inScopeQualified inScopeUnqualified) + + inScopeQualified = Set.fromList (do + (UnAnn.Qual prefix _, symbols) <- Map.toList globalTable + guard (prefix == sModuleName modulename) + symbols) + + inScopeUnqualified = Set.fromList (do + (UnAnn.UnQual _, symbols) <- Map.toList globalTable + symbols) + diff --git a/src/Language/Haskell/Names/GetBound.hs b/src/Language/Haskell/Names/GetBound.hs index 6c89407..f7a522f 100644 --- a/src/Language/Haskell/Names/GetBound.hs +++ b/src/Language/Haskell/Names/GetBound.hs @@ -69,6 +69,8 @@ instance (Data l) => GetBound (Decl l) l where AnnPragma{} -> [] InlineConlikeSig{} -> [] MinimalPragma{} -> [] + -- TODO view patterns, pattern synonyms, role annotations + _ -> [] instance (Data l) => GetBound (QualConDecl l) l where getBound ctx (QualConDecl _ _ _ d) = getBound ctx d diff --git a/src/Language/Haskell/Names/GlobalSymbolTable.hs b/src/Language/Haskell/Names/GlobalSymbolTable.hs index c1e9961..2835db7 100644 --- a/src/Language/Haskell/Names/GlobalSymbolTable.hs +++ b/src/Language/Haskell/Names/GlobalSymbolTable.hs @@ -3,22 +3,19 @@ module Language.Haskell.Names.GlobalSymbolTable where import Language.Haskell.Exts ( - QName(Qual,UnQual,Special),ModuleName(ModuleName)) + QName) import qualified Language.Haskell.Exts.Annotated as Ann ( - QName(Qual,UnQual),Name,ann,ModuleName(ModuleName)) + QName) import Language.Haskell.Exts.Annotated.Simplify ( - sQName,sName) - -import Language.Haskell.Names.SyntaxUtils (setAnn,annName) + sQName) import Data.Map ( Map) import qualified Data.Map as Map ( - empty,unionWith,fromListWith,lookup,map,fromList,toList) + empty,unionWith,fromListWith,lookup,map) import Control.Arrow import Data.List as List (union) -import Control.Monad (guard) import Language.Haskell.Names.Types @@ -44,22 +41,8 @@ lookupValue qn = lookupName qn . filterTable isValue lookupType :: Ann.QName l -> Table -> Result l lookupType qn = lookupName qn . filterTable isType --- | Methods and associated types in instance declarations are referenced --- unqualified and still resolved to a symbol that is only in scope qualified. --- https://www.haskell.org/pipermail/haskell-prime/2008-April/002569.html --- The test for this is tests/annotations/QualifiedMethods.hs -lookupUnqualifiedAsQualified :: Ann.Name l -> Table -> (Result l,Maybe QName) -lookupUnqualifiedAsQualified name tbl = (case Map.lookup unqualifiedName qualificationTable of - Nothing -> (Error (ENotInScope (Ann.UnQual (Ann.ann name) name)),Nothing) - Just qn -> (lookupName qn (filterTable isMethodOrAssociated tbl),Just (sQName qn))) where - unqualifiedName = UnQual (sName name) - qualificationTable = Map.fromList (do - (qn,symbols) <- Map.toList tbl - guard (any isMethodOrAssociated symbols) - case qn of - Qual (ModuleName m) n -> return (UnQual n,Ann.Qual (Ann.ann name) (Ann.ModuleName (Ann.ann name) m) (setAnn (Ann.ann name) (annName n))) - UnQual n -> return (UnQual n,Ann.UnQual (Ann.ann name) (setAnn (Ann.ann name) (annName n))) - Language.Haskell.Exts.Special _ -> []) +lookupMethodOrAssociate :: Ann.QName l -> Table -> Result l +lookupMethodOrAssociate qn = lookupName qn . filterTable isMethodOrAssociated lookupName :: Ann.QName l -> Table -> Result l lookupName qn table = case Map.lookup (sQName qn) table of diff --git a/src/Language/Haskell/Names/Imports.hs b/src/Language/Haskell/Names/Imports.hs index 9a4ff7b..fd28c60 100644 --- a/src/Language/Haskell/Names/Imports.hs +++ b/src/Language/Haskell/Names/Imports.hs @@ -1,133 +1,145 @@ {-# LANGUAGE TypeFamilies #-} {-# OPTIONS_GHC -fno-warn-orphans #-} -- ModName (ModuleName l) module Language.Haskell.Names.Imports - ( processImport - , processImports + ( importTable + , annotateImportDecls ) where -import qualified Data.Set as Set import Data.Monoid import Data.Maybe import Data.Either -import Data.Foldable (fold) import Control.Applicative -import Control.Arrow + import Control.Monad.Writer -import Distribution.HaskellSuite.Modules -import qualified Language.Haskell.Exts as UnAnn (ModuleName(ModuleName)) -import Language.Haskell.Exts.Annotated.Simplify (sName,sModuleName) +import Data.Map as Map (lookup) +import qualified Language.Haskell.Exts as UnAnn ( + ModuleName(ModuleName)) +import Language.Haskell.Exts.Annotated.Simplify ( + sName,sModuleName) import Language.Haskell.Exts.Annotated ( - ModuleName(ModuleName),ImportDecl(..),KnownExtension(ImplicitPrelude), - ann,ImportSpecList(..),ImportSpec(..),Name(..), - Annotated,Namespace(NoNamespace,TypeNamespace)) + Module(Module), ModuleName,ImportDecl(..), + ann,ImportSpecList(..),ImportSpec(..),Name(..), + Annotated) +import Language.Haskell.Exts.Extension ( + Extension(DisableExtension), KnownExtension(ImplicitPrelude)) import Language.Haskell.Names.Types import Language.Haskell.Names.ScopeUtils import qualified Language.Haskell.Names.GlobalSymbolTable as Global import Language.Haskell.Names.SyntaxUtils import Data.List ((\\)) -instance ModName (ModuleName l) where - modToString (ModuleName _ s) = s -preludeName :: String -preludeName = "Prelude" +-- | Compute a table of symbols imported by the given module from the given +-- environment. +importTable :: Environment -> Module l -> Global.Table +importTable environment modul = + foldr Global.mergeTables perhapsPrelude tables where -processImports - :: (MonadModule m, ModuleInfo m ~ [Symbol]) - => ExtensionSet - -> [ImportDecl l] - -> m ([ImportDecl (Scoped l)], Global.Table) -processImports exts importDecls = do + tables = map (importDeclTable environment) importDecls + Module _ _ _ importDecls _ = modul - (annotated,tables) <- mapM processImport importDecls >>= return . unzip - let tbl = foldr Global.mergeTables Global.empty tables + perhapsPrelude = if noImplicitPrelude + then Global.empty + else computeSymbolTable False preludeModuleName preludeSymbols + noImplicitPrelude = + DisableExtension ImplicitPrelude `elem` extensions || isPreludeImported + isPreludeImported = not (null (do + importDecl <- importDecls + guard (sModuleName (importModule importDecl) == preludeModuleName))) + preludeSymbols = fromMaybe [] (Map.lookup preludeModuleName environment) + (_, extensions) = getModuleExtensions modul - let - isPreludeImported = not . null $ - [ () | ImportDecl { importModule = ModuleName _ modName } <- importDecls - , modName == preludeName ] +preludeModuleName :: UnAnn.ModuleName +preludeModuleName = UnAnn.ModuleName "Prelude" - importPrelude = - ImplicitPrelude `Set.member` exts && - not isPreludeImported +importDeclTable :: Environment -> ImportDecl l -> Global.Table +importDeclTable environment importDecl = + computeSymbolTable isQualified moduleName importSymbols where + ImportDecl _ importModuleName isQualified _ _ _ maybeAs maybeImportSpecList = + importDecl + moduleName = sModuleName (fromMaybe importModuleName maybeAs) + importSymbols = case maybeImportSpecList of + Nothing -> + importModuleSymbols + Just importSpecList -> + importSpecListSymbols importModuleName importModuleSymbols importSpecList + importModuleSymbols = fromMaybe [] ( + Map.lookup (sModuleName importModuleName) environment) - tbl' <- - if not importPrelude - then return tbl - else do - -- FIXME currently we don't have a way to signal an error when - -- Prelude cannot be found - syms <- fold `liftM` getModuleInfo preludeName - return $ Global.mergeTables tbl (computeSymbolTable - False -- not qualified - (UnAnn.ModuleName preludeName) - syms) - return (annotated, tbl') +importSpecListSymbols :: ModuleName l -> [Symbol] -> ImportSpecList l -> [Symbol] +importSpecListSymbols importModuleName allSymbols importSpecList = + if isHiding + then allSymbols \\ mentionedSymbols + else mentionedSymbols where + ImportSpecList _ isHiding importSpecs = importSpecList + annotatedImportSpecs = + map (resolveImportSpec importModuleName isHiding allSymbols) importSpecs + mentionedSymbols = + mconcat (rights (map ann2syms annotatedImportSpecs)) -processImport - :: (MonadModule m, ModuleInfo m ~ [Symbol]) - => ImportDecl l - -> m (ImportDecl (Scoped l), Global.Table) -processImport imp = do - mbi <- getModuleInfo (importModule imp) - case mbi of - Nothing -> - let e = EModNotFound (importModule imp) - in return (scopeError e imp, Global.empty) - Just syms -> return $ resolveImportDecl syms imp +-- | Annotate the given list of import declarations with scoping information +-- against the given environment. We need the name of the module that contains +-- the import declarations for error annotations. +annotateImportDecls :: + ModuleName l -> Environment -> [ImportDecl l] -> [ImportDecl (Scoped l)] +annotateImportDecls moduleName environment importDecls = + map (annotateImportDecl moduleName environment) importDecls -resolveImportDecl - :: [Symbol] - -> ImportDecl l - -> (ImportDecl (Scoped l), Global.Table) -resolveImportDecl syms (ImportDecl l mod qual src impSafe pkg mbAs mbSpecList) = - let - (mbSpecList', impSyms) = - (fmap fst &&& maybe syms snd) $ - resolveImportSpecList mod syms <$> mbSpecList - tbl = computeSymbolTable qual (sModuleName (fromMaybe mod mbAs)) impSyms - info = - case mbSpecList' of - Just sl | Scoped (ScopeError e) _ <- ann sl -> - ScopeError e - _ -> Import tbl - in - (ImportDecl - (Scoped info l) - (Scoped (ImportPart syms) <$> mod) - qual - src - impSafe - pkg - (fmap noScope mbAs) - mbSpecList' - , tbl) -resolveImportSpecList - :: ModuleName l - -> [Symbol] - -> ImportSpecList l - -> (ImportSpecList (Scoped l), [Symbol]) -resolveImportSpecList mod allSyms (ImportSpecList l isHiding specs) = - let specs' = map (resolveImportSpec mod isHiding allSyms) specs - mentionedSyms = mconcat $ rights $ map ann2syms specs' - importedSyms = computeImportedSymbols isHiding allSyms mentionedSyms - newAnn = Scoped (ImportPart importedSyms) l - in - (ImportSpecList newAnn isHiding specs', importedSyms) +annotateImportDecl :: + ModuleName l -> Environment -> ImportDecl l -> ImportDecl (Scoped l) +annotateImportDecl moduleName environment importDecl = importDecl' where + ImportDecl + l + importModuleName + isQualified + isSource + isSafe + importPackage + maybeAs + maybeImportSpecList = importDecl + + importDecl' = case Map.lookup (sModuleName importModuleName) environment of + Nothing -> scopeError (EModNotFound importModuleName) importDecl + Just symbols -> + ImportDecl + l' + importModuleName' + isQualified + isSource + isSafe + importPackage + maybeAs' + maybeImportSpecList' where + l' = Scoped info l + importModuleName' = fmap (Scoped (ImportPart symbols)) importModuleName + maybeAs' = fmap noScope maybeAs + maybeImportSpecList' = + fmap (annotateImportSpecList moduleName symbols) maybeImportSpecList + info = case maybeImportSpecList' of + Just sl | Scoped (ScopeError e) _ <- ann sl -> + ScopeError e + _ -> Import table + table = computeSymbolTable isQualified qualificationName importSymbols + qualificationName = sModuleName (fromMaybe importModuleName maybeAs) + importSymbols = + maybe + symbols + (importSpecListSymbols moduleName symbols) + maybeImportSpecList + + +annotateImportSpecList :: + ModuleName l -> [Symbol] -> ImportSpecList l -> ImportSpecList (Scoped l) +annotateImportSpecList moduleName allSymbols importSpecList = + (ImportSpecList l' isHiding importSpecs') where + ImportSpecList l isHiding importSpecs = importSpecList + l' = Scoped (ImportPart importSymbols) l + importSpecs' = map (resolveImportSpec moduleName isHiding allSymbols) importSpecs + importSymbols = importSpecListSymbols moduleName allSymbols importSpecList --- | This function takes care of the possible 'hiding' clause -computeImportedSymbols - :: Bool - -> [Symbol] -- ^ all symbols - -> [Symbol] -- ^ mentioned symbols - -> [Symbol] -- ^ imported symbols -computeImportedSymbols isHiding allSymbols mentionedSymbols = - case isHiding of - False -> mentionedSymbols - True -> allSymbols \\ mentionedSymbols resolveImportSpec :: ModuleName l @@ -138,7 +150,7 @@ resolveImportSpec -- NB: this can be made more efficient resolveImportSpec mod isHiding symbols spec = case spec of - IVar _ (NoNamespace {}) n -> + IVar _ n -> let matches = -- Strictly speaking, the isConstructor check is unnecessary @@ -154,8 +166,7 @@ resolveImportSpec mod isHiding symbols spec = matches spec -- FIXME think about data families etc. - IVar _ (TypeNamespace {}) _ -> error "'type' namespace is not supported yet" -- FIXME - IAbs _ n + IAbs _ _ n | isHiding -> -- This is a bit special. 'C' may match both types/classes and -- data constructors. diff --git a/src/Language/Haskell/Names/Interfaces.hs b/src/Language/Haskell/Names/Interfaces.hs deleted file mode 100644 index 560f333..0000000 --- a/src/Language/Haskell/Names/Interfaces.hs +++ /dev/null @@ -1,148 +0,0 @@ --- | Reading 'Symbols' from and writing to interface files -{-# LANGUAGE DeriveDataTypeable, OverloadedStrings, FlexibleInstances #-} -{-# OPTIONS_GHC -fno-warn-orphans -fno-warn-name-shadowing #-} -module Language.Haskell.Names.Interfaces - ( - -- * High-level interface - NamesDB(..) - , runNamesModuleT - , evalNamesModuleT - -- * Low-level interface - , readInterface - , writeInterface - -- * Exceptions - , IfaceException(..) - ) where - -import Language.Haskell.Names.Types -import Language.Haskell.Exts (ModuleName(ModuleName),prettyPrint,Name) -import Language.Haskell.Names.SyntaxUtils (stringToName,nameToString,annName) -import Language.Haskell.Exts.Annotated.Simplify (sName) -import qualified Data.ByteString.Lazy as BS -import Data.Aeson -import Data.Monoid -import Data.Char -import Data.Typeable -import qualified Data.Map as Map -import Control.Exception -import Control.Applicative -import Control.Monad -import Distribution.HaskellSuite -import qualified Distribution.ModuleName as Cabal -import System.FilePath - -import Paths_haskell_names - -data IfaceException = - -- | Interface could not be parsed. This tells you the file name of the - -- interface file and the parse error text. - BadInterface FilePath String - deriving (Typeable, Show) -instance Exception IfaceException - --- | Read an interface file -readInterface :: FilePath -> IO [Symbol] -readInterface path = - either (throwIO . BadInterface path) return =<< - eitherDecode <$> BS.readFile path - --- | Write an interface file -writeInterface :: FilePath -> [Symbol] -> IO () -writeInterface path iface = - BS.writeFile path $ - encode iface `mappend` BS.pack [fromIntegral $ ord '\n'] - -prettyName :: Name -> String -prettyName = nameToString . annName - -instance ToJSON Symbol where - toJSON symbol = - object ([ - "entity" .= symbolEntity symbol, - "module" .= prettyPrint (symbolModule symbol), - "name" .= prettyName (symbolName symbol)] ++ additionalInfo symbol) - where - additionalInfo symbol = case symbol of - Method { className = cls } -> - ["class" .= prettyName cls] - Selector { typeName = ty, constructors = cons } -> - ["type" .= prettyName ty - ,"constructors".= map prettyName cons] - Constructor { typeName = ty } -> - ["type".= prettyName ty] - _ -> [] - -symbolEntity :: Symbol -> String -symbolEntity i = case i of - Value {} -> "value" - Method {} -> "method" - Selector {} -> "selector" - Constructor {} -> "constructor" - Type {} -> "type" - Data {} -> "data" - NewType {} -> "newtype" - TypeFam {} -> "typeFamily" - DataFam {} -> "dataFamily" - Class {} -> "class" - -parseName :: String -> Name -parseName = sName . stringToName - -instance FromJSON Symbol where - parseJSON (Object v) = do - entity <- v .: "entity" - symbolmodule <- ModuleName <$> v .: "module" - symbolname <- parseName <$> v .: "name" - - case entity :: String of - "value" -> return $ Value symbolmodule symbolname - "method" -> do - cls <- v .: "class" - return (Method symbolmodule symbolname (parseName cls)) - "selector" -> do - typ <- v .: "type" - cons <- v .: "constructors" - return (Selector symbolmodule symbolname (parseName typ) (map parseName cons)) - "constructor" -> do - typ <- v .: "type" - return (Constructor symbolmodule symbolname (parseName typ)) - "type" -> return $ Type symbolmodule symbolname - "data" -> return $ Data symbolmodule symbolname - "newtype" -> return $ NewType symbolmodule symbolname - "typeFamily" -> return $ TypeFam symbolmodule symbolname - "dataFamily" -> return $ DataFam symbolmodule symbolname - "class" -> return $ Class symbolmodule symbolname - _ -> mzero - - parseJSON _ = mzero - --- | The database used by @hs-gen-iface@. Use it together with --- functions from "Distribution.HaskellSuite.Packages". -newtype NamesDB = NamesDB FilePath - -instance IsPackageDB NamesDB where - dbName = return "haskell-names" - readPackageDB init (NamesDB db) = - map (makePkgInfoAbsolute (dropFileName db)) <$> readDB init db - writePackageDB (NamesDB db) = writeDB db - globalDB = Just . NamesDB . ( "libraries" "packages.db") <$> getDataDir - dbFromPath path = return $ NamesDB path - --- | Extension of the name files (i.e. @"names"@) -nameFilesExtension :: FilePath -nameFilesExtension = "names" - --- | Specialized version of 'runModuleT' that works with name files -runNamesModuleT - :: ModuleT [Symbol] IO a - -> Packages - -> Map.Map Cabal.ModuleName [Symbol] - -> IO (a, Map.Map Cabal.ModuleName [Symbol]) -runNamesModuleT ma pkgs = runModuleT ma pkgs nameFilesExtension readInterface - --- | Specialized version of 'evalModuleT' that works with name files -evalNamesModuleT - :: ModuleT [Symbol] IO a - -> Packages - -> IO a -evalNamesModuleT ma pkgs = evalModuleT ma pkgs nameFilesExtension readInterface diff --git a/src/Language/Haskell/Names/ModuleSymbols.hs b/src/Language/Haskell/Names/ModuleSymbols.hs index e382d4f..b47cae0 100644 --- a/src/Language/Haskell/Names/ModuleSymbols.hs +++ b/src/Language/Haskell/Names/ModuleSymbols.hs @@ -53,7 +53,7 @@ getTopDeclSymbols getTopDeclSymbols impTbl modulename d = (case d of TypeDecl _ dh _ -> [declHeadSymbol Type dh] - TypeFamDecl _ dh _ -> [declHeadSymbol TypeFam dh] + TypeFamDecl _ dh _ -> [TypeFam (sModuleName modulename) (sName (getDeclHeadName dh)) Nothing] DataDecl _ dataOrNew _ dh qualConDecls _ -> declHeadSymbol (dataOrNewCon dataOrNew) dh : infos where @@ -72,17 +72,20 @@ getTopDeclSymbols impTbl modulename d = (case d of infos = constructorsToInfos modulename dq cons - DataFamDecl _ _ dh _ -> [declHeadSymbol DataFam dh] + DataFamDecl _ _ dh _ -> [DataFam (sModuleName modulename) (sName (getDeclHeadName dh)) Nothing] - ClassDecl _ _ dh _ mds -> - let - ms = getBound impTbl d + ClassDecl _ _ declHead _ mds -> classSymbol : typeFamilySymbols ++ dataFamilySymbols ++ methodSymbols where cdecls = fromMaybe [] mds - in - (declHeadSymbol Class dh) : - [ declHeadSymbol TypeFam dh | ClsTyFam _ dh _ <- cdecls ] ++ - [ declHeadSymbol DataFam dh | ClsDataFam _ _ dh _ <- cdecls ] ++ - [ Method (sModuleName modulename) (sName mn) (sName (getDeclHeadName dh)) | mn <- ms ] + classSymbol = declHeadSymbol Class declHead + typeFamilySymbols = do + ClsTyFam _ familyHead _ <- cdecls + return (TypeFam (sModuleName modulename) (sName (getDeclHeadName familyHead)) (Just (sName (getDeclHeadName declHead)))) + dataFamilySymbols = do + ClsDataFam _ _ familyHead _ <- cdecls + return (DataFam (sModuleName modulename) (sName (getDeclHeadName familyHead)) (Just (sName (getDeclHeadName declHead)))) + methodSymbols = do + methodName <- getBound impTbl d + return (Method (sModuleName modulename) (sName methodName) (sName (getDeclHeadName declHead))) FunBind _ ms -> [ Value (sModuleName modulename) (sName vn) ] where vn : _ = getBound impTbl ms diff --git a/src/Language/Haskell/Names/Open/Base.hs b/src/Language/Haskell/Names/Open/Base.hs index 9d77ea0..d8f89e3 100644 --- a/src/Language/Haskell/Names/Open/Base.hs +++ b/src/Language/Haskell/Names/Open/Base.hs @@ -3,7 +3,7 @@ -- -- You can look at "Language.Haskell.Exts.Annotated" source as an example -- of how to use this module. -{-# LANGUAGE RankNTypes, FlexibleInstances, FlexibleContexts, UndecidableInstances, DefaultSignatures, OverlappingInstances, TemplateHaskell, ScopedTypeVariables #-} +{-# LANGUAGE RankNTypes, FlexibleInstances, FlexibleContexts, UndecidableInstances, DefaultSignatures, TemplateHaskell, ScopedTypeVariables #-} {-# LANGUAGE ImplicitParams, KindSignatures #-} module Language.Haskell.Names.Open.Base where @@ -12,6 +12,7 @@ import qualified Language.Haskell.Names.LocalSymbolTable as Local import Language.Haskell.Names.GetBound import Language.Haskell.Names.RecordWildcards import Language.Haskell.Exts.Annotated +import qualified Language.Haskell.Exts.Syntax as UnAnn import Control.Applicative import Control.Monad.Identity import Data.List @@ -39,11 +40,15 @@ data NameContext | Other -- | Contains information about the node's enclosing scope. Can be --- accessed through the lenses: 'gTable', 'lTable', 'nameCtx', 'wcNames'. +-- accessed through the lenses: 'gTable', 'lTable', 'nameCtx', +-- 'instanceQualification', 'wcNames'. +-- If we enter an instance with a qualified class name we have to +-- remember the qualification to resolve method names. data Scope = Scope { _gTable :: Global.Table , _lTable :: Local.Table , _nameCtx :: NameContext + , _instQual :: Maybe UnAnn.ModuleName , _wcNames :: WcNames } @@ -51,7 +56,7 @@ makeLens ''Scope -- | Create an initial scope initialScope :: Global.Table -> Scope -initialScope tbl = Scope tbl Local.empty Other [] +initialScope tbl = Scope tbl Local.empty Other Nothing [] -- | Merge local tables of two scopes. The other fields of the scopes are -- assumed to be the same. @@ -91,7 +96,7 @@ class Typeable a => Resolvable a where :: (Applicative f, ?alg :: Alg f) => a -> Scope -> f a -instance (Typeable a, GTraversable Resolvable a) => Resolvable a where +instance {-# OVERLAPPABLE #-} (Typeable a, GTraversable Resolvable a) => Resolvable a where rtraverse = defaultRtraverse -- | Analogous to 'gmap', but for 'Resolvable' @@ -145,3 +150,6 @@ exprUV = setNameCtx ReferenceUV exprUT :: Scope -> Scope exprUT = setNameCtx ReferenceUT + +instQ :: Maybe UnAnn.ModuleName -> Scope -> Scope +instQ m = setL instQual m diff --git a/src/Language/Haskell/Names/Open/Derived.hs b/src/Language/Haskell/Names/Open/Derived.hs index 72114d1..573ad1e 100644 --- a/src/Language/Haskell/Names/Open/Derived.hs +++ b/src/Language/Haskell/Names/Open/Derived.hs @@ -146,3 +146,7 @@ deriveGTraversable ''Overlap deriveGTraversable ''Sign deriveGTraversable ''Namespace + +deriveGTraversable ''PatternSynDirection + +deriveGTraversable ''Role diff --git a/src/Language/Haskell/Names/Open/Instances.hs b/src/Language/Haskell/Names/Open/Instances.hs index 6390b10..b3400d1 100644 --- a/src/Language/Haskell/Names/Open/Instances.hs +++ b/src/Language/Haskell/Names/Open/Instances.hs @@ -1,6 +1,7 @@ {-# OPTIONS_GHC -fno-warn-orphans #-} {-# LANGUAGE FlexibleContexts, FlexibleInstances, TemplateHaskell, - MultiParamTypeClasses, UndecidableInstances, RankNTypes #-} + MultiParamTypeClasses, UndecidableInstances, RankNTypes, + OverlappingInstances #-} {-# LANGUAGE ImplicitParams #-} -- MonoLocalBinds extension prevents premature generalization, which @@ -68,8 +69,25 @@ instance (Resolvable l, SrcInfo l, D.Data l) => Resolvable (Decl l) where <| sc -: assoc <| sc -: mp <| exprV sc -: ops + InstDecl l mOverlap rule mInstDecls -> + let sc' = instQ (nameQualification (instanceRuleClass rule)) sc + in c InstDecl + <| sc' -: l + <| sc' -: mOverlap + <| sc' -: rule + <| sc' -: mInstDecls _ -> defaultRtraverse e sc +instanceRuleClass :: InstRule l -> QName l +instanceRuleClass (IParen _ instRule) = instanceRuleClass instRule +instanceRuleClass (IRule _ _ _ instHead) = instanceHeadClass instHead + +instanceHeadClass :: InstHead l -> QName l +instanceHeadClass (IHCon _ qn) = qn +instanceHeadClass (IHInfix _ _ qn) = qn +instanceHeadClass (IHParen _ instHead) = instanceHeadClass instHead +instanceHeadClass (IHApp _ instHead _) = instanceHeadClass instHead + instance (Resolvable l, SrcInfo l, D.Data l) => Resolvable (Type l) where rtraverse e sc = defaultRtraverse e (exprT sc) diff --git a/src/Language/Haskell/Names/Recursive.hs b/src/Language/Haskell/Names/Recursive.hs index c3f0858..f76d068 100644 --- a/src/Language/Haskell/Names/Recursive.hs +++ b/src/Language/Haskell/Names/Recursive.hs @@ -1,19 +1,18 @@ {-# LANGUAGE TypeFamilies, ScopedTypeVariables #-} module Language.Haskell.Names.Recursive - ( computeInterfaces - , getInterfaces - , annotateModule + ( resolve + , annotate ) where +import Data.Foldable (traverse_) import Data.Graph(stronglyConnComp, flattenSCC) -import Data.Monoid import Data.Data (Data) -import qualified Data.Set as Set -import Control.Monad hiding (forM_) +import Control.Monad (forM, forM_, unless) + +import qualified Data.Map as Map (insert) +import Control.Monad.State.Strict (State, execState, get, modify) import Language.Haskell.Exts.Annotated -import Distribution.HaskellSuite.Modules -import Data.Maybe -import Data.Foldable +import Language.Haskell.Exts.Annotated.Simplify (sModuleName) import Language.Haskell.Names.Types import Language.Haskell.Names.SyntaxUtils @@ -24,106 +23,59 @@ import Language.Haskell.Names.Imports import Language.Haskell.Names.Open.Base import Language.Haskell.Names.Annotated + +-- | Takes a list of modules and an environment and updates the environment +-- with each of the given modules' exported symbols. +resolve :: (Data l, Eq l) => [Module l] -> Environment -> Environment +resolve modules environment = updatedEnvironment where + moduleSCCs = groupModules modules + updatedEnvironment = execState (traverse_ findFixPoint moduleSCCs) environment + -- | Take a set of modules and return a list of sets, where each sets for -- a strongly connected component in the import graph. --- The boolean determines if imports using @SOURCE@ are taken into account. -groupModules :: forall l . [Module l] -> [[Module l]] +groupModules :: [Module l] -> [[Module l]] groupModules modules = - map flattenSCC $ stronglyConnComp $ map mkNode modules - where - mkNode :: Module l -> (Module l, ModuleName (), [ModuleName ()]) - mkNode m = - ( m - , dropAnn $ getModuleName m - , map (dropAnn . importModule) $ getImports m - ) - --- | Annotate a module with scoping information. This assumes that all --- module dependencies have been resolved and cached — usually you need --- to run 'computeInterfaces' first, unless you have one module in --- isolation. -annotateModule - :: (MonadModule m, ModuleInfo m ~ [Symbol], Data l, SrcInfo l, Eq l) - => Language -- ^ base language - -> [Extension] -- ^ global extensions (e.g. specified on the command line) - -> Module l -- ^ input module - -> m (Module (Scoped l)) -- ^ output (annotated) module -annotateModule lang exts mod@(Module lm mh os is ds) = do - let extSet = moduleExtensions lang exts mod - (imp, impTbl) <- processImports extSet is - let tbl = moduleTable impTbl mod - (exp, _syms) <- processExports tbl mod - - let - lm' = none lm - os' = fmap noScope os - is' = imp - ds' = annotate (initialScope tbl) `map` ds - - mh' = flip fmap mh $ \(ModuleHead lh n mw _me) -> - let - lh' = none lh - n' = noScope n - mw' = fmap noScope mw - me' = exp - in ModuleHead lh' n' mw' me' - - return $ Module lm' mh' os' is' ds' + map flattenSCC (stronglyConnComp (map moduleNode modules)) -annotateModule _ _ _ = error "annotateModule: non-standard modules are not supported" +moduleNode :: Module l -> (Module l, ModuleName (), [ModuleName ()]) +moduleNode modul = + ( modul + , dropAnn (getModuleName modul) + , map (dropAnn . importModule) (getImports modul) + ) --- | Compute interfaces for a set of mutually recursive modules and write --- the results to the cache. Return the set of import/export errors. -findFixPoint - :: (Ord l, Data l, MonadModule m, ModuleInfo m ~ [Symbol]) - => [(Module l, ExtensionSet)] - -- ^ module and all extensions with which it is to be compiled. - -- Use 'moduleExtensions' to build this list. - -> m (Set.Set (Error l)) -findFixPoint mods = go mods (map (const mempty) mods) where - go mods syms = do - forM_ (zip syms mods) $ \(s,(m, _)) -> insertInCache (getModuleName m) s - (syms', errors) <- liftM unzip $ forM mods $ \(m, extSet) -> do - (imp, impTbl) <- processImports extSet $ getImports m - let tbl = moduleTable impTbl m - (exp, syms) <- processExports tbl m - return (syms, foldMap getErrors imp <> foldMap getErrors exp) - if syms' == syms - then return $ mconcat errors - else go mods syms' +-- | Compute interfaces for a set of mutually recursive modules and +-- update the environment accordingly. +findFixPoint :: (Data l, Eq l) => [Module l] -> State Environment () +findFixPoint modules = loop (replicate (length modules) []) where + loop modulesSymbols = do + forM_ (zip modules modulesSymbols) (\(modul, symbols) -> do + modify (Map.insert (sModuleName (getModuleName modul)) symbols)) + environment <- get + modulesSymbols' <- forM modules (\modul -> do + let globalTable = moduleTable (importTable environment modul) modul + return (exportedSymbols globalTable modul)) + unless (modulesSymbols == modulesSymbols') (loop modulesSymbols') --- | 'computeInterfaces' takes a list of possibly recursive modules and --- computes the interface of each module. The computed interfaces are --- written into the @m@'s cache and are available to further computations --- in this monad. --- --- Returns the set of import/export errors. Note that the interfaces are --- registered in the cache regardless of whether there are any errors, but --- if there are errors, the interfaces may be incomplete. -computeInterfaces - :: (MonadModule m, ModuleInfo m ~ [Symbol], Data l, SrcInfo l, Ord l) - => Language -- ^ base language - -> [Extension] -- ^ global extensions (e.g. specified on the command line) - -> [Module l] -- ^ input modules - -> m (Set.Set (Error l)) -- ^ errors in export or import lists -computeInterfaces lang exts = - liftM fold . mapM findFixPoint . map supplyExtensions . groupModules - where - supplyExtensions = map $ \m -> (m, moduleExtensions lang exts m) +-- | Annotate a module with scoping information using the given environment. +-- All imports of the given module should be in the environment. +annotate :: (Data l, Eq l, SrcInfo l) => Environment -> Module l -> Module (Scoped l) +annotate environment modul@(Module _ _ _ _ _) = + Module l' maybeModuleHead' modulePragmas' importDecls' decls' where + Module l maybeModuleHead modulePragmas importDecls decls = modul + l' = none l + maybeModuleHead' = case maybeModuleHead of + Nothing -> Nothing + Just (ModuleHead lh moduleName maybeWarning maybeExports) -> + Just (ModuleHead lh' moduleName' maybeWarning' maybeExports') where + lh'= none lh + moduleName' = noScope moduleName + maybeWarning' = fmap noScope maybeWarning + maybeExports' = fmap (annotateExportSpecList globalTable) maybeExports + modulePragmas' = fmap noScope modulePragmas + importDecls' = annotateImportDecls moduleName environment importDecls + decls' = map (annotateDecl (initialScope globalTable)) decls + globalTable = moduleTable (importTable environment modul) modul + moduleName = getModuleName modul +annotate _ _ = error "annotateModule: non-standard modules are not supported" --- | Like 'computeInterfaces', but also returns a list of interfaces, one --- per module and in the same order -getInterfaces - :: (MonadModule m, ModuleInfo m ~ [Symbol], Data l, SrcInfo l, Ord l) - => Language -- ^ base language - -> [Extension] -- ^ global extensions (e.g. specified on the command line) - -> [Module l] -- ^ input modules - -> m ([[Symbol]], Set.Set (Error l)) -- ^ output modules, and errors in export or import lists -getInterfaces lang exts mods = do - errs <- computeInterfaces lang exts mods - ifaces <- forM mods $ \mod -> - let modName = getModuleName mod in - fromMaybe (error $ msg modName) `liftM` lookupInCache modName - return (ifaces, errs) - where - msg modName = "getInterfaces: module " ++ modToString modName ++ " is not in the cache" diff --git a/src/Language/Haskell/Names/ScopeUtils.hs b/src/Language/Haskell/Names/ScopeUtils.hs index 578234e..157d0ab 100644 --- a/src/Language/Haskell/Names/ScopeUtils.hs +++ b/src/Language/Haskell/Names/ScopeUtils.hs @@ -25,6 +25,8 @@ symbolParent :: Symbol -> Maybe Name symbolParent (Selector { typeName = n }) = Just n symbolParent (Constructor { typeName = n }) = Just n symbolParent (Method { className = n }) = Just n +symbolParent (TypeFam { associate = as }) = as +symbolParent (DataFam { associate = as }) = as symbolParent _ = Nothing computeSymbolTable diff --git a/src/Language/Haskell/Names/SyntaxUtils.hs b/src/Language/Haskell/Names/SyntaxUtils.hs index 9705cbe..fcfa4f8 100644 --- a/src/Language/Haskell/Names/SyntaxUtils.hs +++ b/src/Language/Haskell/Names/SyntaxUtils.hs @@ -2,6 +2,7 @@ module Language.Haskell.Names.SyntaxUtils ( dropAnn , setAnn , annName + , nameQualification , getModuleName , getImports , getExportSpecList @@ -18,14 +19,10 @@ module Language.Haskell.Names.SyntaxUtils , nameToQName , unCName , getErrors - -- export ExtensionSet here for the outside users - , ExtensionSet - , moduleExtensions , getModuleExtensions ) where import Prelude hiding (concatMap) import Data.Char -import Data.Maybe import Data.Either import Data.Foldable hiding (elem) import qualified Data.Set as Set @@ -43,6 +40,14 @@ annName :: UnAnn.Name -> Name () annName (UnAnn.Ident n) = Ident () n annName (UnAnn.Symbol n) = Symbol () n +nameQualification :: QName l -> Maybe UnAnn.ModuleName +nameQualification (UnQual _ _) = + Nothing +nameQualification (Special _ _) = + Nothing +nameQualification (Qual _ (ModuleName _ moduleName) _) = + Just (UnAnn.ModuleName moduleName) + getModuleName :: Module l -> ModuleName l getModuleName (Module _ (Just (ModuleHead _ mn _ _)) _ _ _) = mn getModuleName (XmlPage _ mn _ _ _ _ _) = mn @@ -65,7 +70,7 @@ getExportSpecList m = me where ModuleHead _ _ _ me = getModuleHead m getModuleHead :: Module l -> ModuleHead l getModuleHead (Module _ (Just mh) _ _ _) = mh getModuleHead (XmlHybrid _ (Just mh) _ _ _ _ _ _ _) = mh -getModuleHead m = ModuleHead l (main_mod l) Nothing (Just (ExportSpecList l [EVar l (NoNamespace l) (UnQual l (Ident l "main"))])) +getModuleHead m = ModuleHead l (main_mod l) Nothing (Just (ExportSpecList l [EVar l (UnQual l (Ident l "main"))])) where l = ann m qNameToName :: QName l -> Name l @@ -151,20 +156,6 @@ getErrors = foldl' f Set.empty f errors (Scoped (ScopeError e) _) = Set.insert e errors f errors _ = errors --- | Compute the extension set for the given module, based on the global --- preferences (e.g. specified on the command line) and module's LANGUAGE --- pragmas. -moduleExtensions - :: Language -- ^ base language - -> [Extension] -- ^ global extensions - -> Module l - -> ExtensionSet -moduleExtensions globalLang globalExts mod = - let - (mbModLang, modExts) = getModuleExtensions mod - lang = fromMaybe globalLang mbModLang - kexts = toExtensionList lang (globalExts ++ modExts) - in Set.fromList kexts getModuleExtensions :: Module l -> (Maybe Language, [Extension]) getModuleExtensions mod = diff --git a/src/Language/Haskell/Names/Types.hs b/src/Language/Haskell/Names/Types.hs index 64d263b..d66f4d2 100644 --- a/src/Language/Haskell/Names/Types.hs +++ b/src/Language/Haskell/Names/Types.hs @@ -6,13 +6,11 @@ import Language.Haskell.Exts import qualified Language.Haskell.Exts.Annotated as Ann import Data.Typeable import Data.Data -import qualified Data.Set as Set import Data.Foldable as F import Data.Traversable import Data.Map (Map) import Text.Printf -type ExtensionSet = Set.Set KnownExtension -- | Information about an entity. Carries at least the module it was originally -- declared in and its name. @@ -59,11 +57,13 @@ data Symbol | TypeFam { symbolModule :: ModuleName , symbolName :: Name + , associate :: Maybe Name } -- ^ type family | DataFam { symbolModule :: ModuleName , symbolName :: Name + , associate :: Maybe Name } -- ^ data family | Class @@ -73,6 +73,9 @@ data Symbol -- ^ type class deriving (Eq, Ord, Show, Data, Typeable) +-- | A map from module name to list of symbols it exports. +type Environment = Map ModuleName [Symbol] + -- | A pair of the name information and original annotation. Used as an -- annotation type for AST. data Scoped l = Scoped (NameInfo l) l diff --git a/tests/annotations/QualifiedMethods.hs b/tests/annotations/QualifiedMethods.hs index 1a71082..b2919dd 100644 --- a/tests/annotations/QualifiedMethods.hs +++ b/tests/annotations/QualifiedMethods.hs @@ -5,6 +5,8 @@ import qualified ExportListWildcards as ExportListWildcards import qualified DataFamilies as DataFamilies +import Prelude + data Rodor = Rodor x = ExportListWildcards.Foo1 @@ -14,4 +16,4 @@ instance ExportListWildcards.Bar Rodor where instance DataFamilies.ListLike Rodor where type I Rodor = Rodor - h _ = Rodor + method1 _ = Rodor diff --git a/tests/annotations/QualifiedMethods.hs.golden b/tests/annotations/QualifiedMethods.hs.golden index da985f0..ca296f9 100644 --- a/tests/annotations/QualifiedMethods.hs.golden +++ b/tests/annotations/QualifiedMethods.hs.golden @@ -1,28 +1,28 @@ TypeFamilies at 1:14 is none -Rodor at 8:6 is a type or class defined here -Rodor at 8:14 is a value bound here -x at 10:1 is a value bound here -Foo1 at 10:5 is a global constructor, ExportListWildcards.Foo1 -Foo1 at 10:5 is a global constructor, ExportListWildcards.Foo1 -Bar at 12:10 is a global type class, ExportListWildcards.Bar -Bar at 12:10 is a global type class, ExportListWildcards.Bar -Rodor at 12:34 is a global data type, QualifiedMethods.Rodor -Rodor at 12:34 is a global data type, QualifiedMethods.Rodor -x at 13:5 is a global method, ExportListWildcards.x -Rodor at 13:7 is a global constructor, QualifiedMethods.Rodor -Rodor at 13:7 is a global constructor, QualifiedMethods.Rodor -x at 13:15 is a global value, QualifiedMethods.x -x at 13:15 is a global value, QualifiedMethods.x -ListLike at 15:10 is a global type class, DataFamilies.ListLike -ListLike at 15:10 is a global type class, DataFamilies.ListLike -Rodor at 15:32 is a global data type, QualifiedMethods.Rodor -Rodor at 15:32 is a global data type, QualifiedMethods.Rodor -I at 16:10 is a global type family, DataFamilies.I -I at 16:10 is a global type family, DataFamilies.I -Rodor at 16:12 is a global data type, QualifiedMethods.Rodor -Rodor at 16:12 is a global data type, QualifiedMethods.Rodor -Rodor at 16:20 is a global data type, QualifiedMethods.Rodor -Rodor at 16:20 is a global data type, QualifiedMethods.Rodor -h at 17:5 is a global method, DataFamilies.h -Rodor at 17:11 is a global constructor, QualifiedMethods.Rodor -Rodor at 17:11 is a global constructor, QualifiedMethods.Rodor +Rodor at 10:6 is a type or class defined here +Rodor at 10:14 is a value bound here +x at 12:1 is a value bound here +Foo1 at 12:5 is a global constructor, ExportListWildcards.Foo1 +Foo1 at 12:5 is a global constructor, ExportListWildcards.Foo1 +Bar at 14:10 is a global type class, ExportListWildcards.Bar +Bar at 14:10 is a global type class, ExportListWildcards.Bar +Rodor at 14:34 is a global data type, QualifiedMethods.Rodor +Rodor at 14:34 is a global data type, QualifiedMethods.Rodor +x at 15:5 is a global method, ExportListWildcards.x +Rodor at 15:7 is a global constructor, QualifiedMethods.Rodor +Rodor at 15:7 is a global constructor, QualifiedMethods.Rodor +x at 15:15 is a global value, QualifiedMethods.x +x at 15:15 is a global value, QualifiedMethods.x +ListLike at 17:10 is a global type class, DataFamilies.ListLike +ListLike at 17:10 is a global type class, DataFamilies.ListLike +Rodor at 17:32 is a global data type, QualifiedMethods.Rodor +Rodor at 17:32 is a global data type, QualifiedMethods.Rodor +I at 18:10 is a global type family, DataFamilies.I +I at 18:10 is a global type family, DataFamilies.I +Rodor at 18:12 is a global data type, QualifiedMethods.Rodor +Rodor at 18:12 is a global data type, QualifiedMethods.Rodor +Rodor at 18:20 is a global data type, QualifiedMethods.Rodor +Rodor at 18:20 is a global data type, QualifiedMethods.Rodor +method1 at 19:5 is a global method, DataFamilies.method1 +Rodor at 19:17 is a global constructor, QualifiedMethods.Rodor +Rodor at 19:17 is a global constructor, QualifiedMethods.Rodor diff --git a/tests/environment/Prelude.symbols.golden b/tests/environment/Prelude.symbols.golden new file mode 100644 index 0000000..d36bb47 --- /dev/null +++ b/tests/environment/Prelude.symbols.golden @@ -0,0 +1 @@ +[{"name":"Bool","module":"GHC.Types","entity":"data"},{"name":"False","module":"GHC.Types","type":"Bool","entity":"constructor"},{"name":"True","module":"GHC.Types","type":"Bool","entity":"constructor"},{"name":"&&","module":"GHC.Classes","entity":"value"},{"name":"||","module":"GHC.Classes","entity":"value"},{"name":"not","module":"GHC.Classes","entity":"value"},{"name":"otherwise","module":"GHC.Base","entity":"value"},{"name":"Maybe","module":"Data.Maybe","entity":"data"},{"name":"Nothing","module":"Data.Maybe","type":"Maybe","entity":"constructor"},{"name":"Just","module":"Data.Maybe","type":"Maybe","entity":"constructor"},{"name":"maybe","module":"Data.Maybe","entity":"value"},{"name":"Either","module":"Data.Either","entity":"data"},{"name":"Left","module":"Data.Either","type":"Either","entity":"constructor"},{"name":"Right","module":"Data.Either","type":"Either","entity":"constructor"},{"name":"either","module":"Data.Either","entity":"value"},{"name":"Ordering","module":"GHC.Types","entity":"data"},{"name":"LT","module":"GHC.Types","type":"Ordering","entity":"constructor"},{"name":"EQ","module":"GHC.Types","type":"Ordering","entity":"constructor"},{"name":"GT","module":"GHC.Types","type":"Ordering","entity":"constructor"},{"name":"Char","module":"GHC.Types","entity":"data"},{"name":"String","module":"GHC.Base","entity":"type"},{"name":"fst","module":"Data.Tuple","entity":"value"},{"name":"snd","module":"Data.Tuple","entity":"value"},{"name":"curry","module":"Data.Tuple","entity":"value"},{"name":"uncurry","module":"Data.Tuple","entity":"value"},{"name":"Eq","module":"GHC.Classes","entity":"class"},{"name":"==","module":"GHC.Classes","entity":"method","class":"Eq"},{"name":"/=","module":"GHC.Classes","entity":"method","class":"Eq"},{"name":"Ord","module":"GHC.Classes","entity":"class"},{"name":"compare","module":"GHC.Classes","entity":"method","class":"Ord"},{"name":"<","module":"GHC.Classes","entity":"method","class":"Ord"},{"name":"<=","module":"GHC.Classes","entity":"method","class":"Ord"},{"name":">=","module":"GHC.Classes","entity":"method","class":"Ord"},{"name":">","module":"GHC.Classes","entity":"method","class":"Ord"},{"name":"max","module":"GHC.Classes","entity":"method","class":"Ord"},{"name":"min","module":"GHC.Classes","entity":"method","class":"Ord"},{"name":"Enum","module":"GHC.Enum","entity":"class"},{"name":"succ","module":"GHC.Enum","entity":"method","class":"Enum"},{"name":"pred","module":"GHC.Enum","entity":"method","class":"Enum"},{"name":"toEnum","module":"GHC.Enum","entity":"method","class":"Enum"},{"name":"fromEnum","module":"GHC.Enum","entity":"method","class":"Enum"},{"name":"enumFrom","module":"GHC.Enum","entity":"method","class":"Enum"},{"name":"enumFromThen","module":"GHC.Enum","entity":"method","class":"Enum"},{"name":"enumFromTo","module":"GHC.Enum","entity":"method","class":"Enum"},{"name":"enumFromThenTo","module":"GHC.Enum","entity":"method","class":"Enum"},{"name":"Bounded","module":"GHC.Enum","entity":"class"},{"name":"minBound","module":"GHC.Enum","entity":"method","class":"Bounded"},{"name":"maxBound","module":"GHC.Enum","entity":"method","class":"Bounded"},{"name":"Int","module":"GHC.Types","entity":"data"},{"name":"Integer","module":"GHC.Integer.Type","entity":"data"},{"name":"Float","module":"GHC.Types","entity":"data"},{"name":"Double","module":"GHC.Types","entity":"data"},{"name":"Rational","module":"GHC.Real","entity":"type"},{"name":"Num","module":"GHC.Num","entity":"class"},{"name":"+","module":"GHC.Num","entity":"method","class":"Num"},{"name":"-","module":"GHC.Num","entity":"method","class":"Num"},{"name":"*","module":"GHC.Num","entity":"method","class":"Num"},{"name":"negate","module":"GHC.Num","entity":"method","class":"Num"},{"name":"abs","module":"GHC.Num","entity":"method","class":"Num"},{"name":"signum","module":"GHC.Num","entity":"method","class":"Num"},{"name":"fromInteger","module":"GHC.Num","entity":"method","class":"Num"},{"name":"Real","module":"GHC.Real","entity":"class"},{"name":"toRational","module":"GHC.Real","entity":"method","class":"Real"},{"name":"Integral","module":"GHC.Real","entity":"class"},{"name":"quot","module":"GHC.Real","entity":"method","class":"Integral"},{"name":"rem","module":"GHC.Real","entity":"method","class":"Integral"},{"name":"div","module":"GHC.Real","entity":"method","class":"Integral"},{"name":"mod","module":"GHC.Real","entity":"method","class":"Integral"},{"name":"quotRem","module":"GHC.Real","entity":"method","class":"Integral"},{"name":"divMod","module":"GHC.Real","entity":"method","class":"Integral"},{"name":"toInteger","module":"GHC.Real","entity":"method","class":"Integral"},{"name":"Fractional","module":"GHC.Real","entity":"class"},{"name":"/","module":"GHC.Real","entity":"method","class":"Fractional"},{"name":"recip","module":"GHC.Real","entity":"method","class":"Fractional"},{"name":"fromRational","module":"GHC.Real","entity":"method","class":"Fractional"},{"name":"Floating","module":"GHC.Float","entity":"class"},{"name":"pi","module":"GHC.Float","entity":"method","class":"Floating"},{"name":"exp","module":"GHC.Float","entity":"method","class":"Floating"},{"name":"log","module":"GHC.Float","entity":"method","class":"Floating"},{"name":"sqrt","module":"GHC.Float","entity":"method","class":"Floating"},{"name":"**","module":"GHC.Float","entity":"method","class":"Floating"},{"name":"logBase","module":"GHC.Float","entity":"method","class":"Floating"},{"name":"sin","module":"GHC.Float","entity":"method","class":"Floating"},{"name":"cos","module":"GHC.Float","entity":"method","class":"Floating"},{"name":"tan","module":"GHC.Float","entity":"method","class":"Floating"},{"name":"asin","module":"GHC.Float","entity":"method","class":"Floating"},{"name":"acos","module":"GHC.Float","entity":"method","class":"Floating"},{"name":"atan","module":"GHC.Float","entity":"method","class":"Floating"},{"name":"sinh","module":"GHC.Float","entity":"method","class":"Floating"},{"name":"cosh","module":"GHC.Float","entity":"method","class":"Floating"},{"name":"tanh","module":"GHC.Float","entity":"method","class":"Floating"},{"name":"asinh","module":"GHC.Float","entity":"method","class":"Floating"},{"name":"acosh","module":"GHC.Float","entity":"method","class":"Floating"},{"name":"atanh","module":"GHC.Float","entity":"method","class":"Floating"},{"name":"RealFrac","module":"GHC.Real","entity":"class"},{"name":"properFraction","module":"GHC.Real","entity":"method","class":"RealFrac"},{"name":"truncate","module":"GHC.Real","entity":"method","class":"RealFrac"},{"name":"round","module":"GHC.Real","entity":"method","class":"RealFrac"},{"name":"ceiling","module":"GHC.Real","entity":"method","class":"RealFrac"},{"name":"floor","module":"GHC.Real","entity":"method","class":"RealFrac"},{"name":"RealFloat","module":"GHC.Float","entity":"class"},{"name":"floatRadix","module":"GHC.Float","entity":"method","class":"RealFloat"},{"name":"floatDigits","module":"GHC.Float","entity":"method","class":"RealFloat"},{"name":"floatRange","module":"GHC.Float","entity":"method","class":"RealFloat"},{"name":"decodeFloat","module":"GHC.Float","entity":"method","class":"RealFloat"},{"name":"encodeFloat","module":"GHC.Float","entity":"method","class":"RealFloat"},{"name":"exponent","module":"GHC.Float","entity":"method","class":"RealFloat"},{"name":"significand","module":"GHC.Float","entity":"method","class":"RealFloat"},{"name":"scaleFloat","module":"GHC.Float","entity":"method","class":"RealFloat"},{"name":"isNaN","module":"GHC.Float","entity":"method","class":"RealFloat"},{"name":"isInfinite","module":"GHC.Float","entity":"method","class":"RealFloat"},{"name":"isDenormalized","module":"GHC.Float","entity":"method","class":"RealFloat"},{"name":"isIEEE","module":"GHC.Float","entity":"method","class":"RealFloat"},{"name":"isNegativeZero","module":"GHC.Float","entity":"method","class":"RealFloat"},{"name":"atan2","module":"GHC.Float","entity":"method","class":"RealFloat"},{"name":"subtract","module":"GHC.Num","entity":"value"},{"name":"even","module":"GHC.Real","entity":"value"},{"name":"odd","module":"GHC.Real","entity":"value"},{"name":"gcd","module":"GHC.Real","entity":"value"},{"name":"lcm","module":"GHC.Real","entity":"value"},{"name":"^","module":"GHC.Real","entity":"value"},{"name":"^^","module":"GHC.Real","entity":"value"},{"name":"fromIntegral","module":"GHC.Real","entity":"value"},{"name":"realToFrac","module":"GHC.Real","entity":"value"},{"name":"Monad","module":"GHC.Base","entity":"class"},{"name":">>=","module":"GHC.Base","entity":"method","class":"Monad"},{"name":">>","module":"GHC.Base","entity":"method","class":"Monad"},{"name":"return","module":"GHC.Base","entity":"method","class":"Monad"},{"name":"fail","module":"GHC.Base","entity":"method","class":"Monad"},{"name":"Functor","module":"GHC.Base","entity":"class"},{"name":"fmap","module":"GHC.Base","entity":"method","class":"Functor"},{"name":"mapM","module":"Control.Monad","entity":"value"},{"name":"mapM_","module":"Control.Monad","entity":"value"},{"name":"sequence","module":"Control.Monad","entity":"value"},{"name":"sequence_","module":"Control.Monad","entity":"value"},{"name":"=<<","module":"Control.Monad","entity":"value"},{"name":"id","module":"GHC.Base","entity":"value"},{"name":"const","module":"GHC.Base","entity":"value"},{"name":".","module":"GHC.Base","entity":"value"},{"name":"flip","module":"GHC.Base","entity":"value"},{"name":"$","module":"GHC.Base","entity":"value"},{"name":"until","module":"GHC.Base","entity":"value"},{"name":"asTypeOf","module":"GHC.Base","entity":"value"},{"name":"error","module":"GHC.Err","entity":"value"},{"name":"undefined","module":"GHC.Err","entity":"value"},{"name":"seq","module":"GHC.Prim","entity":"value"},{"name":"$!","module":"Prelude","entity":"value"},{"name":"map","module":"GHC.Base","entity":"value"},{"name":"++","module":"GHC.Base","entity":"value"},{"name":"filter","module":"GHC.List","entity":"value"},{"name":"head","module":"GHC.List","entity":"value"},{"name":"last","module":"GHC.List","entity":"value"},{"name":"tail","module":"GHC.List","entity":"value"},{"name":"init","module":"GHC.List","entity":"value"},{"name":"null","module":"GHC.List","entity":"value"},{"name":"length","module":"GHC.List","entity":"value"},{"name":"!!","module":"GHC.List","entity":"value"},{"name":"reverse","module":"GHC.List","entity":"value"},{"name":"foldl","module":"GHC.List","entity":"value"},{"name":"foldl1","module":"Data.List","entity":"value"},{"name":"foldr","module":"GHC.Base","entity":"value"},{"name":"foldr1","module":"GHC.List","entity":"value"},{"name":"and","module":"GHC.List","entity":"value"},{"name":"or","module":"GHC.List","entity":"value"},{"name":"any","module":"GHC.List","entity":"value"},{"name":"all","module":"GHC.List","entity":"value"},{"name":"sum","module":"Data.List","entity":"value"},{"name":"product","module":"Data.List","entity":"value"},{"name":"concat","module":"GHC.List","entity":"value"},{"name":"concatMap","module":"GHC.List","entity":"value"},{"name":"maximum","module":"Data.List","entity":"value"},{"name":"minimum","module":"Data.List","entity":"value"},{"name":"scanl","module":"GHC.List","entity":"value"},{"name":"scanl1","module":"GHC.List","entity":"value"},{"name":"scanr","module":"GHC.List","entity":"value"},{"name":"scanr1","module":"GHC.List","entity":"value"},{"name":"iterate","module":"GHC.List","entity":"value"},{"name":"repeat","module":"GHC.List","entity":"value"},{"name":"replicate","module":"GHC.List","entity":"value"},{"name":"cycle","module":"GHC.List","entity":"value"},{"name":"take","module":"GHC.List","entity":"value"},{"name":"drop","module":"GHC.List","entity":"value"},{"name":"splitAt","module":"GHC.List","entity":"value"},{"name":"takeWhile","module":"GHC.List","entity":"value"},{"name":"dropWhile","module":"GHC.List","entity":"value"},{"name":"span","module":"GHC.List","entity":"value"},{"name":"break","module":"GHC.List","entity":"value"},{"name":"elem","module":"GHC.List","entity":"value"},{"name":"notElem","module":"GHC.List","entity":"value"},{"name":"lookup","module":"GHC.List","entity":"value"},{"name":"zip","module":"GHC.List","entity":"value"},{"name":"zip3","module":"GHC.List","entity":"value"},{"name":"zipWith","module":"GHC.List","entity":"value"},{"name":"zipWith3","module":"GHC.List","entity":"value"},{"name":"unzip","module":"GHC.List","entity":"value"},{"name":"unzip3","module":"GHC.List","entity":"value"},{"name":"lines","module":"Data.List","entity":"value"},{"name":"words","module":"Data.List","entity":"value"},{"name":"unlines","module":"Data.List","entity":"value"},{"name":"unwords","module":"Data.List","entity":"value"},{"name":"ShowS","module":"GHC.Show","entity":"type"},{"name":"Show","module":"GHC.Show","entity":"class"},{"name":"showsPrec","module":"GHC.Show","entity":"method","class":"Show"},{"name":"showList","module":"GHC.Show","entity":"method","class":"Show"},{"name":"show","module":"GHC.Show","entity":"method","class":"Show"},{"name":"shows","module":"GHC.Show","entity":"value"},{"name":"showChar","module":"GHC.Show","entity":"value"},{"name":"showString","module":"GHC.Show","entity":"value"},{"name":"showParen","module":"GHC.Show","entity":"value"},{"name":"ReadS","module":"Text.ParserCombinators.ReadP","entity":"type"},{"name":"Read","module":"GHC.Read","entity":"class"},{"name":"readsPrec","module":"GHC.Read","entity":"method","class":"Read"},{"name":"readList","module":"GHC.Read","entity":"method","class":"Read"},{"name":"reads","module":"Text.Read","entity":"value"},{"name":"readParen","module":"GHC.Read","entity":"value"},{"name":"read","module":"Text.Read","entity":"value"},{"name":"lex","module":"GHC.Read","entity":"value"},{"name":"IO","module":"GHC.Types","entity":"newtype"},{"name":"putChar","module":"System.IO","entity":"value"},{"name":"putStr","module":"System.IO","entity":"value"},{"name":"putStrLn","module":"System.IO","entity":"value"},{"name":"print","module":"System.IO","entity":"value"},{"name":"getChar","module":"System.IO","entity":"value"},{"name":"getLine","module":"System.IO","entity":"value"},{"name":"getContents","module":"System.IO","entity":"value"},{"name":"interact","module":"System.IO","entity":"value"},{"name":"FilePath","module":"GHC.IO","entity":"type"},{"name":"readFile","module":"System.IO","entity":"value"},{"name":"writeFile","module":"System.IO","entity":"value"},{"name":"appendFile","module":"System.IO","entity":"value"},{"name":"readIO","module":"System.IO","entity":"value"},{"name":"readLn","module":"System.IO","entity":"value"},{"name":"IOError","module":"GHC.IO.Exception","entity":"type"},{"name":"ioError","module":"GHC.IO.Exception","entity":"value"},{"name":"userError","module":"GHC.IO.Exception","entity":"value"}] diff --git a/tests/exports/DataFamilies.hs b/tests/exports/DataFamilies.hs index ddbaec1..bb557cf 100644 --- a/tests/exports/DataFamilies.hs +++ b/tests/exports/DataFamilies.hs @@ -1,10 +1,13 @@ {-# LANGUAGE TypeFamilies #-} -module DataFamilies where +module DataFamilies ( + Vector, + ListLike(..), + Vector(..)) where data family Vector a class ListLike a where type I a - h :: a -> I a + method1 :: a -> I a newtype instance Vector () = U_Vector () diff --git a/tests/exports/DataFamilies.hs.golden b/tests/exports/DataFamilies.hs.golden index 1631d65..e89279b 100644 --- a/tests/exports/DataFamilies.hs.golden +++ b/tests/exports/DataFamilies.hs.golden @@ -1,6 +1,7 @@ [ DataFam { symbolModule = ModuleName "DataFamilies" , symbolName = Ident "Vector" + , associate = Nothing } , Class { symbolModule = ModuleName "DataFamilies" @@ -9,12 +10,18 @@ , TypeFam { symbolModule = ModuleName "DataFamilies" , symbolName = Ident "I" + , associate = Just (Ident "ListLike") } , Method { symbolModule = ModuleName "DataFamilies" - , symbolName = Ident "h" + , symbolName = Ident "method1" , className = Ident "ListLike" } +, DataFam + { symbolModule = ModuleName "DataFamilies" + , symbolName = Ident "Vector" + , associate = Nothing + } , Constructor { symbolModule = ModuleName "DataFamilies" , symbolName = Ident "U_Vector" diff --git a/tests/run.hs b/tests/run.hs index 3dcd27c..d2f7e4b 100644 --- a/tests/run.hs +++ b/tests/run.hs @@ -1,9 +1,7 @@ --- vim:fdm=marker:foldtext=foldtext() {-# LANGUAGE FlexibleInstances, OverlappingInstances, ImplicitParams, MultiParamTypeClasses, FlexibleContexts, GADTs #-} -- GHC 7.8 fails with the default context stack size of 20 {-# OPTIONS_GHC -fcontext-stack=50 #-} --- Imports {{{ import Test.Tasty hiding (defaultMain) import Test.Tasty.Golden import Test.Tasty.Golden.Manage @@ -14,6 +12,7 @@ import System.IO import System.Exit import Data.Monoid import Data.List hiding (find) +import Data.Map (Map) import qualified Data.Map as Map import qualified Data.Set as Set import Control.Monad.Identity @@ -25,8 +24,8 @@ import qualified Data.Foldable as F import Language.Haskell.Exts.Annotated hiding (NewType) import qualified Language.Haskell.Exts.Annotated as Syntax (DataOrNew(NewType)) +import qualified Language.Haskell.Exts as U (ModuleName(ModuleName)) import Language.Haskell.Names -import Language.Haskell.Names.Interfaces import Language.Haskell.Names.Exports import Language.Haskell.Names.Imports import Language.Haskell.Names.Annotated @@ -34,99 +33,81 @@ import Language.Haskell.Names.Open import Language.Haskell.Names.ModuleSymbols import Language.Haskell.Names.SyntaxUtils import qualified Language.Haskell.Names.GlobalSymbolTable as Global -import Distribution.HaskellSuite -import qualified Distribution.ModuleName as Cabal import Data.Generics.Traversable import Data.Proxy --- }}} - --- Common definitions {{{ -type MT = ModuleT [Symbol] IO - -main = defaultMain . testGroup "Tests" =<< tests - -goldenTest name = goldenVsFileDiff name (\ref new -> ["diff", "-u", ref, new]) - --- All tests are created in the same ModuleT session. This means that --- export tests are available for import in subsequent tests (because of --- the getIfaces call). However, import tests are not registered in the --- monad, so they are not available for import. - -tests = - liftM concat . sequence $ - [ evalNamesModuleT (sequence [exportTests, importTests, annotationTests]) [] - ] - -parseAndPrepare file = - return . fmap srcInfoSpan . fromParseResult =<< parseFile file - -lang = Haskell2010 -exts = [DisableExtension ImplicitPrelude] -getIfaces = getInterfaces lang exts -getTestFiles :: MonadIO m => FilePath -> m [FilePath] -getTestFiles dir = liftIO $ find (return True) (extension ==? ".hs") dir --- }}} ------------------------------------------------------ --- Export test: parse a source file, dump its symbols ------------------------------------------------------ --- {{{ -exportTest file iface = - goldenTest file golden out run - where - golden = file <.> "golden" - out = file <.> "out" - run = writeBinaryFile out $ ppShow iface - -exportTests :: MT TestTree -exportTests = do - testFiles <- getTestFiles "tests/exports" - parsed <- liftIO $ mapM parseAndPrepare testFiles - (ifaces, errors) <- getIfaces parsed - - -- report possible problems - when (not $ Set.null errors) $ liftIO $ do - printf "The following unexpected problems were found:\n" - F.for_ errors $ \e -> do - putStr $ ppError e - exitFailure - - return $ testGroup "exports" $ zipWith exportTest testFiles ifaces --- }}} +main :: IO () +main = do + exportTestModules <- getTestModules "tests/exports" + importTestModules <- getTestModules "tests/imports" + annotationTestModules <- getTestModules "tests/annotations" + let environment = resolve (map snd exportTestModules) Map.empty + defaultMain (testGroup "Tests" [ + exportTests environment exportTestModules, + importTests environment importTestModules, + annotationTests environment annotationTestModules, + environmentTests]) + +getTestModules :: FilePath -> IO [(FilePath, Module SrcSpan)] +getTestModules directory = do + paths <- find (return True) (extension ==? ".hs") directory + forM paths (\path -> do + result <- parseFile path + return (path, fmap srcInfoSpan (fromParseResult result))) + +exportTests :: Environment -> [(FilePath, Module SrcSpan)] -> TestTree +exportTests environment exportTestModules = + testGroup "exports" (map (exportTest environment) exportTestModules) + +-- | Dump exported symbols. +-- TODO: check for errors during resolution. +exportTest :: Environment -> (FilePath, Module SrcSpan) -> TestTree +exportTest environment (path, modul) = goldenTest path run where + out = path <.> "out" + run = writeBinaryFile out (ppShow exports) + exports = exportedSymbols globalTable modul + globalTable = moduleTable (importTable environment modul) modul + +importTests :: Environment -> [(FilePath, Module SrcSpan)] -> TestTree +importTests environment importTestModules = + testGroup "imports" (map (importTest environment) importTestModules) + +-- | Dump global table. +importTest :: Environment -> (FilePath, Module SrcSpan) -> TestTree +importTest environment (path, modul) = goldenTest path run where + out = path <.> "out" + run = writeBinaryFile out (ppShow table) + table = importTable environment modul + +annotationTests :: Environment -> [(FilePath, Module SrcSpan)] -> TestTree +annotationTests environment annotationTestModules = + testGroup "annotations" (map (annotationTest environment) annotationTestModules) + +-- | Annotate and pretty print the annotations. +annotationTest :: Environment -> (FilePath, Module SrcSpan) -> TestTree +annotationTest environment (path, modul) = goldenTest path run where + out = path <.> "out" + run = writeBinaryFile out (printAnns annotatedModule) + annotatedModule = annotate environment modul + +environmentTests :: TestTree +environmentTests = goldenTest path run where + run = do + baseEnvironment <- loadBase + writeSymbols out (baseEnvironment Map.! (U.ModuleName "Prelude")) + path = "tests/environment/Prelude.symbols" + out = path <.> "out" + +goldenTest :: FilePath -> IO () -> TestTree +goldenTest path = goldenVsFileDiff + path + (\ref new -> ["diff", "-u", ref, new]) + (path <.> "golden") + (path <.> "out") ----------------------------------------------------------- --- Import test: parse a source file, dump its global table ----------------------------------------------------------- --- {{{ -importTest :: FilePath -> Global.Table -> TestTree -importTest file tbl = - goldenTest file golden out run - where - golden = file <.> "golden" - out = file <.> "out" - run = do - writeBinaryFile out $ ppShow tbl - -getGlobalTable :: FilePath -> MT Global.Table -getGlobalTable file = do - mod <- liftIO $ parseAndPrepare file - let extSet = moduleExtensions lang exts mod - snd <$> processImports extSet (getImports mod) - -importTests :: MT TestTree -importTests = do - testFiles <- getTestFiles "tests/imports" - filesAndTables <- forM testFiles $ \file -> (,) file <$> getGlobalTable file - return $ testGroup "imports" $ map (uncurry importTest) filesAndTables --- }}} ------------------------------------------------------------------- --- Annotation test: parse the source, annotate it and pretty-print ------------------------------------------------------------------- --- {{{ --- Code to retrieve annotations from the AST using GTraversable class TestAnn a where getAnn :: a -> Maybe (String, Scoped SrcSpan) @@ -165,25 +146,6 @@ printAnns = go a = one a ++ gfoldMap go a in go --- Actual tests -annotationTest file annotatedMod = goldenTest file golden out run - where - golden = file <.> "golden" - out = file <.> "out" - run = do - liftIO $ writeBinaryFile out $ printAnns annotatedMod - -getAnnotated file = do - mod <- liftIO $ parseAndPrepare file - annotateModule lang exts mod - -annotationTests = do - testFiles <- getTestFiles "tests/annotations" - filesAndMods <- forM testFiles $ \file -> (,) file <$> getAnnotated file - return $ testGroup "annotations" $ - map (uncurry annotationTest) filesAndMods --- }}} - ----------------------- -- Formatting utilities -----------------------