1
votes

I am new to haskell and I want to learn how to create GUIs using the haskell platform. I found this tic tac toe example but I can't seem to figure it out how to run it.

https://github.com/DevJac/gloss-tic-tac-toe

I runned Setup.hs, it compiled but nothing happend. Tried cabal run and this is the output:

Package has never been configured. Configuring with default flags. If this fails, please run configure manually. Resolving dependencies... Configuring gloss-tic-tac-toe-0.1.0.0... cabal: At least the following dependencies are missing: base ==4.7.*, gloss >=1.9.2.1 && <1.10

Any ideas?

2
I am the author of that tic tac toe game. I have updated it so you can build it using stack.Buttons840

2 Answers

0
votes

Update:

Here's what I did to get it to compile:

  1. First run cabal install gloss-examples

It will take a while as it will install a lot of dependencies. These dependencies are also needed for the tic-tac-toe program.

  1. Then do this:

    git clone https://github.com/DevJac/gloss-tic-tac-toe cd gloss-tic-tac-toe

and change the build-depends stanza in the .cabal file to read:

  build-depends:       base       >= 4.7,
                       gloss      >= 1.9.2.1,
                       containers >= 0.5.5.1

Basically just remove all upper bounds.

  1. Run cabal build

  2. If the build succeeds, run the executable:

    ./dist/build/gloss-tic-tac-toe/gloss-tic-tac-toe
    
0
votes

It seems you are quite new to haskell so it is best to install stack.

Then after the git clone https://github.com/DevJac/gloss-tic-tac-toe it is best to make the following changes to the downloaded source:

Delete the libsrc folder you won't need it, replace the build depends section of gloss-tic-tac-toe.cabal file with the following:

  build-depends:       base       >= 4.8     && < 4.9
               ,       gloss
               ,       containers

and add the new file stack.yaml

resolver: lts-5.17
packages:
- '.'
extra-deps:
- gloss-1.10.1.1
- gloss-rendering-1.10.1.1
flags: {}
extra-package-dbs: []

This is the full configuration you need - then running

$ > stack build
... (might take some time)
$ > stack exec -- gloss-tic-tac-toe

will run the game and you can play!