【发布时间】:2020-06-09 15:55:17
【问题描述】:
首先,我不熟悉在 Haskell 中使用 cabal 和外部包。
我正在尝试使用 MyLib 中的 Graphics.Gloss 包。如果我在library 和executable 的build-depends 中都包含gloss,我可以让它工作。
这是 cabal 文件的相关部分:
library
exposed-modules: MyLib
build-depends: base ^>=4.13.0.0,
gloss ^>=1.13.1.1
default-language: Haskell2010
executable ray-tracer
main-is: Main.hs
other-modules: MyLib
build-depends: base ^>=4.13.0.0, ray-tracer,
haskell-say ^>=1.0.0.0,
gloss ^>=1.13.1.1
MyLib.hs
module MyLib (someFunc) where
import Graphics.Gloss
someFunc :: IO ()
someFunc = display (InWindow "My Window" (200,200) (10,10)) white (Circle 80)
Main.hs
module Main where
import qualified MyLib (someFunc)
import HaskellSay (haskellSay)
main :: IO ()
main = do
MyLib.someFunc
当gloss 仅包含在library 依赖项中时,为什么这不起作用?
【问题讨论】: