Trying to port Snake game to 0.12, kind of confused

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:

https://bitbucket.org/mike1127/snakeport/src/master/Main.purs

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

@mike1127 - I get “Access Denied” when trying to view that link to https://bitbucket.org/mike1127/snakeport/src/master/Main.purs

Hi, I think it should be fixed. I set the repository to public. Also try

https://bitbucket.org/mike1127/snakeport/src/master/

if my first link doesn’t work.

Mike

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.

I managed to get it compiling again:

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.