gpt4 book ai didi

haskell - 不在范围 : type constructor or class 内

转载 作者:行者123 更新时间:2023-12-01 23:15:50 24 4
gpt4 key购买 nike

我有一个游戏的 Haskell 代码,可以在其中找到完整的代码 here .

以下是BoardMain.hs

{-# Language MultiParamTypeClasses, FunctionalDependencies #-}

import Control.Monad.Trans (liftIO)
import Graphics.UI.Gtk
import Graphics.UI.Gtk.Layout.BackgroundContainer
import Graphics.UI.Gtk.Board.BoardLink
import GtkPegSolitaire


attemptDragStart :: Board Int Tile Peg -> (Int, Int) -> IO Bool
attemptDragStart _ _ = return True

当我运行此程序时,出现以下错误

 BoardMain.hs:39:21: error:
Not in scope: type constructor or class ‘Board’

BoardMain.hs:39:31: error:
Not in scope: type constructor or class ‘Tile’

BoardMain.hs:39:36: error:
Not in scope: type constructor or class ‘Peg’

我知道我犯了一个小错误。如有任何帮助,我们将不胜感激。

GtkPegSolitaire.hsPegSolitaire.hs 可以找到 here

最佳答案

您的类型的定义位于 PegSolitaire 中,但您不将其导入主模块中。在那里,您只导入了 GtkPegSolitaire 和一些库模块。导入是不可传递的,因此您需要将 import PegSolitaire 添加到主模块。 (如果导入是可传递的,那么库编写者就不可能对公共(public) API 隐藏模块。)

关于haskell - 不在范围 : type constructor or class 内,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43344823/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com