我正在尝试 OpenGL 教程。我正在运行安装了 Haskell 平台的 macosx
import Graphics.Rendering.OpenGL
import Graphics.UI.GLUT
main :: IO ()
main = do
(progname, _) <- getArgsAndInitialize
createWindow "Hello World"
displayCallback $= display
display :: IO ()
display = do
clear [ ColorBuffer ]
flush
这是我得到的错误,“clear”、“ColorBuffer”和“Flush”重复以下内容
Hello_World.hs:8:19:
Ambiguous occurrence `$='
It could refer to either `Graphics.Rendering.OpenGL.$=',
imported from `Graphics.Rendering.OpenGL' at Hello_World.hs:1:1-32
(and originally defined in `Data.StateVar')
or `Graphics.UI.GLUT.$=',
imported from `Graphics.UI.GLUT' at Hello_World.hs:2:1-23
(and originally defined in `OpenGL-2.2.3.1:Graphics.Rendering.OpenGL.GL.StateVar')
这段代码以前可以工作,从那以后我通过 cabal install 和 homebrew 安装了一些软件包。
因为我认为它可能与这里的包有关,所以这里是“ghc-pkg list”(抱歉这个块,只是额外的信息可能会有所帮助)
Cabal-1.14.0
GLUT-2.1.2.1
HTTP-4000.2.5
HUnit-1.2.5.1
OpenGL-2.2.3.1
QuickCheck-2.5.1.1
array-0.4.0.0
async-2.0.1.3
base-4.5.1.0
bin-package-db-0.0.0.0
binary-0.5.1.0
bytestring-0.9.2.1
cgi-3001.1.7.4
containers-0.4.2.1
deepseq-1.3.0.0
directory-1.1.0.2
extensible-exceptions-0.1.1.4
fgl-5.4.2.4
filepath-1.3.0.0
ghc-7.4.2
ghc-prim-0.2.0.0
haskell-platform-2012.4.0.0
haskell-src-1.0.1.5
haskell2010-1.1.0.1
haskell98-2.0.0.1
hoopl-3.8.7.3
hpc-0.5.1.1
html-1.0.1.2
integer-gmp-0.4.0.0
mtl-2.1.2
network-2.3.1.0
old-locale-1.0.0.4
old-time-1.1.0.0
parallel-3.2.0.3
parsec-3.1.3
pretty-1.1.1.0
primitive-0.5.0.1
process-1.1.0.1
random-1.0.1.1
regex-base-0.93.2
regex-compat-0.95.1
regex-posix-0.95.2
rts-1.0
split-0.2.1.1
stm-2.4
syb-0.3.7
template-haskell-2.7.0.0
text-0.11.2.3
time-1.4
transformers-0.3.0.0
unix-2.5.1.1
vector-0.10.0.1
xhtml-3000.2.1
zlib-0.5.4.0
/Users/james/.ghc/x86_64-darwin-7.4.2/package.conf.d
Cabal-1.16.0.3
GLURaw-1.3.0.0
ObjectName-1.0.0.0
OpenGL-2.6.0.1
OpenGLRaw-1.3.0.0
StateVar-1.0.0.0
Tensor-1.0.0.1
aeson-0.6.1.0
ansi-terminal-0.6
ansi-wl-pprint-0.6.6
attoparsec-0.10.4.0
blaze-builder-0.3.1.0
blaze-html-0.5.1.3
blaze-markup-0.5.1.4
cairo-0.12.4
cpphs-1.16
data-default-0.5.0
dlist-0.5
fay-0.14.1.0
fay-base-0.14.1.0
ghc-paths-0.1.0.9
gio-0.12.4
glib-0.12.4
gtk-0.12.4
hashable-1.2.0.5
haskeline-0.7.0.3
haskell-lexer-1.0
haskell-src-exts-1.13.5
hostname-1.0
language-ecmascript-0.10
language-haskell-extract-0.2.4
optparse-applicative-0.5.2.1
pango-0.12.4
pretty-show-1.5
safe-0.3.3
terminfo-0.3.2.5
test-framework-0.8
test-framework-hunit-0.3.0
test-framework-th-0.2.4
uniplate-1.6.10
unordered-containers-0.2.3.0
utf8-string-0.3.7
xml-1.3.12