These are chat archives for aspidites/ThinkTank

Jan 2016
Edwin Marshall
Jan 24 2016 05:55
I have a good bit of the core data types finished. Tomorrow, I'll work on writing a server that serves a rudimentary API. Once that is done, it should be possible to write clients in various languages. I also wrote Show instances for numerous data types, which means that games can be pretty printed in the console.
Jan 24 2016 05:56
Nice. That was quick.
Edwin Marshall
Jan 24 2016 06:05
JSON serialization was so easy
a few instances that I did by hand, but for the rest, default was fine
Oh. and I just wrote a free monad for tank actions just because it was so easy. Haven't written the combinators yet though
Edwin Marshall
Jan 24 2016 19:00
Correction: JSON serialization is easy when you don't have a custom infinite data structure (AKA Free monad)
That said, it is now possible to serialize a series of actions
Edwin Marshall
Jan 24 2016 19:17

For instance:

actions = do
  turn northWest
  move forward

Which can alternatively be written as:

actions = turn northWest >> move forward >> fire

Will serialize to the following JSON:

[{"turn": "NorthWest"},
 {"move": "Forward"},
 {"fire": ""}]

I'm not entirely sold on the serialization format, but that's modifiable. It's a consequence of JavaScript not having real sum types. I could have opted for a Mayebe type, which would have turned that empty string into a null, but I'm not convinced that gains us much.

Edwin Marshall
Jan 24 2016 20:13
Hmm...json encodings are a bit limiting. They feel so lossy