I've a Haskell code for a game where the complete one can be found here.
The following is 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
When I'm running this, I'm getting the following error
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’
I know that I've made a small mistake. Any help is appreciated.
GtkPegSolitaire.hs
and PegSolitaire.hs
can be found here
The definitions of your types are in PegSolitaire
, but you do not import it in the main module. There, you have only imported GtkPegSolitaire
and a handful of library modules. Imports are not transitive, so you need to add import PegSolitaire
to the main module. (If imports were transitive, it would, for one, be impossible for library writers to keep modules hidden from the public API.)
As duplode mentioned above, I've forgotten to import some modules. So, what all that should be done is add the following 4 lines to BoardMain.hs
import PegSolitaire
import Graphics.UI.Gtk.Board.TiledBoard
import Data.Maybe
import Control.Monad
GtkPegSolitaire.hs
and PegSolitaire.hs
are correct.
The author of this game has been notified of this issue.
Thanks duplode for helping us.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With