Claus Reinke wrote:
Is it really always safe to combine packages that depend on one base
with packages that depend on another? My guess is "no, but ghc will
catch any compatibility issues", so the cabal warning perhaps shouldn't
be dropped? Either way, safe does not mean useable, eg, how does one use
such combinations within ghci?
-- pretend we're loading a package that depends on base 3 into a
-- session that otherwise depends on base 4
$ ./ghc-6.11.20081004/bin/ghcii.sh -package base-3.0.3.0 -ignore-dot-ghci
GHCi, version 6.11.20081004: http://www.haskell.org/ghc/ :? for help
Loading package ghc-prim ... linking ... done.
Loading package integer ... linking ... done.
Loading package base ... linking ... done.
Loading package syb ... linking ... done.
Loading package base-3.0.3.0 ... linking ... done.
Prelude> :set -v
wired-in package ghc-prim mapped to ghc-prim-0.1.0.0
wired-in package integer mapped to integer-0.1.0.0
wired-in package base mapped to base-4.0.0.0
wired-in package rts mapped to rts-1.0
wired-in package haskell98 mapped to haskell98-1.0.1.0
wired-in package syb mapped to syb-0.1.0.0
wired-in package template-haskell mapped to template-haskell-2.3.0.0
wired-in package dph-seq[""] not found.
wired-in package dph-par[""] not found.
Prelude> :m +Data.Generics.Basics
Could not find module `Data.Generics.Basics':
it was found in multiple packages: base-3.0.3.0 syb
Even if there was syntax to add one of the two modules (temporarily
hiding one of the packages resets the session, <package>:<name> isn't
accepted), all of ghci would then have to disambiguate (in output and
input) between the imported items and others of the same name, where a
qualified name is no longer sufficient, eg
base-3.0.3.0:Data.Generics.Basics.Data
base-4.0.0.0:Data.Data.Data
$ ./ghc-6.11.20081004/bin/ghc -package base-3.0.3.0 -ignore-dot-ghci
-e ':info Data.Generics.Basics.Data'
Top level:
Failed to load interface for `Data.Generics.Basics':
it was found in multiple packages: base-3.0.3.0 syb
$ ./ghc-6.11.20081004/bin/ghc -package base-3.0.3.0 -ignore-dot-ghci
-e ':info Data.Generics.Basics.Data' -hide-package syb
.. (works)
So it isn't just cabal that isn't quite prepared for multiple versions
of a single package coexisting.
GHC is behaving correctly here, isn't it? If you want to use base-3 with
GHCi or --make you probably ought to use -hide-all-packages and specify
exactly which packages you want in scope.
I'm not sure exactly what it is you want to happen instead. Could you
elaborate?
Cheers,
Simon
_______________________________________________
Cvs-ghc mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/cvs-ghc