I’m trying to learn PureScript and mostly sticking to 0.12 although may be a mistake given that so few examples out there are compatible with it. I thought I would try to port the Snake game to 0.12, found here in its original version:
I created a file with lots of stub functions using unsafeCrashWith just to see if I could get the thing to type check. It’s having trouble which I don’t understand, something about record types not matching. Here is the file I created so far:
sorry, I see that my attempt to post unformatted code didn’t work. I’ll try another way – give me a few minutes. update: okay see post above with link to bitbucket
A few of your functions have Partial => constraint. You’ll need to eject that at some point using unsafePartial. I can’t clone your project at this time to try building it, but that’s the first thing I saw. I’ll try cloning later.
LMK if you have questions. I don’t know why Gen was the result of the step function – I can’t think of a reason to do that. Quickcheck is for tests, not for the main program.
Thanks! I was just copying code from a web page I found online which claimed to have a working port of the Elm “snake game” to Purescript. I think there were using Quickcheck as a pseudorandom generator for some aspect of the game. At this point I doubt their code was working. I’m going to continue working with it function-by-function, first to get it to compile, then to get it to run.