In my first attempt at using cabal I ran into something that confuses me.
I have a Haskell file that starts with
import Data.List(nub,(\\), minimumBy)
import Data.Array
import Data.Ord(Ordering(..))
This compiles fine with command-line ghc.
But I thought I would use cabal, since I'm editing with IntelliJ and it uses cabal as a build tool. The cabal file that gets produced by IntelliJ (or cabal, or some combination) contains the line
build-depends: base
And I get the error that it can't find Data.Array
So I change the build-depends line to
build-depends: base, haskell2010
And I get an error that Prelude was found in multiple packages.
So I try
build-depends: haskell2010
And I get an error that Data.Ord can't be found.
Eventually I figured out that I could use
build-depends: base, array
or I could use just
build-depends: haskell2010
and omit the import of Data.Ord.
But all this made me wonder why there is a base package as well as a haskell2010 package? What makes sense to me is to start with the modules defined in the language standard (which is what I think haskell2010 represents) and then add on nonstandard libraries as needed. Is base a subset of haskell2010? I also noticed that hoogle tends to steer me toward base and away from haskell2010.
In short what is the relationship between the base and haskell2010 packages? And how should one decide which to use to get the Prelude?