Reputation: 2674
I don't understand how to import "sub-packages" in stack (if this is not the correct term, please let me know so I can edit).
Here's the top of a simple file:
{-# LANGUAGE OverloadedStrings #-}
module Conduit where
import Data.Conduit
import qualified Data.Conduit.List as CL
import qualified Data.Conduit.Binary as CB
Two dependencies are listed. In myproject.cabal, I have:
executable myproject
hs-source-dirs: src
main-is: Main.hs
default-language: Haskell2010
build-depends: base >= 4.7 && < 5,
conduit
stack build -v
gives me this error:
2018-02-08 13:28:06.923836: [warn] 7 | import qualified Data.Conduit.Binary as CB
I am not sure what to include in the cabal executable directive, each of these throws errors:
build-depends: base >= 4.7 && < 5,
conduit,
conduit.list,
conduit.binary
build-depends: base >= 4.7 && < 5,
conduit,
conduit-list
conduit-binary
Upvotes: 0
Views: 212
Reputation: 34378
Data.Conduit.Binary
is a module. It is part of a package called conduit-extra
. Packages are what Stack (and cabal-install, were you using that instead) installs, and what you should add to the build-depends
of the .cabal file:
build-depends: base >= 4.7 && < 5,
conduit,
conduit-extra
As for Data.Conduit.List
, it is part of the conduit
package, so you don't need another entry for it. One quick way of clarifying such things is doing a Hoogle search for the module (the package it belongs to will be pointed out in the top bar of the documentation page).
See also: What's the difference between module, package and library in Haskell?; Packages, modules and import in Haskell.
Upvotes: 3