reset password
Author Message
Anon
Posts: 134
Posted 20:35 Nov 01, 2016 |

I am getting this error when I execute the command 'tttPlay' . can anyone help me out to resolve it? Thank you 

 

<interactive>:6:1: error:
    * No instance for (Show (History TTT -> History TTT))
        arising from a use of `print'
        (maybe you haven't applied a function to enough arguments?)
    * In a stmt of an interactive GHCi command: print it
*Main>

rabbott
Posts: 1649
Posted 20:38 Nov 01, 2016 |

It's possible you downloaded a version that was between synchronized saves. Try downloading again. 

Also, the system isn't intended to be printed. Just use the commands to play the game. The output will be produced. If you want to see the output again, enter: 

> it

not

> print it

 

Last edited by rabbott at 20:47 Nov 01, 2016.
lishenyu
Posts: 103
Posted 21:57 Nov 01, 2016 |

hi professor, I redownloaded the history and TTTwithhistory, and when I loaded them with ghci it shows errors:

Not in scope: type constructor or class ‘TTT’


 

rabbott
Posts: 1649
Posted 23:30 Nov 01, 2016 |

It wasn't necessary for me, but try putting this in the export list of TicTacToe.

module TicTacToe (TTT(TTT), next, newGame, play, start, startAt) where

or

module TicTacToe (TTT(..), next, newGame, play, start, startAt) where

And if neither of those work, try dropping the export list entirely

module TicTacToe where -- Exports everything

Let me know tomorrow if any of that helps.

(I'm using WinGHCi, not GHCi directly.)

Last edited by rabbott at 10:12 Nov 02, 2016.
rabbott
Posts: 1649
Posted 10:08 Nov 02, 2016 |

I loaded TTTWithHistory.hs into a fresh GHCi with each of the TicTacToe module export lines listed above as well as

module TicTacToe (TTT, next, newGame, play, start, startAt) where

and had no problem with any of them. When I removed the TTT from the export line, error messages were produced. So you need at least TTT. That's not surprising since TTTWithHistory refers to it.

All three files should be in the same directory. TTTWithHistory imports the other two modules.

Last edited by rabbott at 10:11 Nov 02, 2016.