What lib can I try for handle keypress events in console?
brick, hscurses/ncurses, terminfo for unix-only as raw as you can get without switching to a GUI (which isn't very)
win32 package has windows options
Hi, I'm working on the Tic Tac Toe network game from the NICTA/Data61 course. I'm trying to implement `game` (https://github.com/data61/fp-course/blob/master/projects/NetworkServer/haskell/src/Network/Server/TicTacToe/Game.hs#L201-L206) with `execLoop` (https://github.com/data61/fp-course/blob/master/projects/NetworkServer/haskell/src/Network/Server/TicTacToe/Loop.hs#L33-L40). I need to provide an `Env` to `exe
`s` I presume is an empty Tic Tac Toe `Board`. If `game` is used solely in GHCI, then I should be able to make up a bogus `Env` for `execLoop`. Here is the only usage of `game`: https://github.com/data61/fp-course/blob/master/projects/NetworkServer/haskell/src/Network/Server/TicTacToe/Main.hs#L8
Am I approaching this the correct way? Thank you!
be advised, that exercise needs a bit of work, which should be happening this year
dibblego: thanks, this project has been instructive and helpful but I'll keep that in mind
Do you guys know about some sort of *adjacency matrix* Haskell library?
Need it in order to give the Conway's game of life a try within a State monad.
Well, I might be a *simple* Graph in this case...
eatman: I think Data.Graph uses an adjacency list representation, in the containers package
I'd probably just use a Data.Map, typically.
But also, are you playing Conway's game of life on weird graphs? I wouldn't expect to usually need to represent the underlying graph because it's so uniform -- just record which cells are active somehow.
adarqui_: This is the one I'm reading about.
Just wondering why I can load the Data.Graph module in a regular ghci instance but not inside an existing project.
eatman: you may be interested in reading this: https://samtay.github.io/posts/comonadic-game-of-life.html
I'd like to give it a try before reading **The over optimized solution**.
Good habit imo. I linked that mostly because that's a quite interesting approach, very different from what you would see in an imperative language.
To be honnest, this is mainly because of the "let's read how it's supposed to be done" habit that I failed Haskell every time before.
anyone using pipes with servant?
guess that would work
Exesu me, can somebody explain what are benefits of machines over the conduits?
Akii: hey. i finished my project last night. nothing fancy, especially after you helped get the data under control, the rest was just some simple transformations and presentation. so, as an exercise, i implemented a.. ToPretty typeclass along the lines of To/FromJSON, for representation of the structure http://lpaste.net/5331030037632122880 lines 10-15 with example at line 50. is that
completely insane? i mean, at least i didn't do instance Show, right? :)
the only difference from your contribution yesterday Maybe Entry as entry, of course :eyeroll:, was missing in 5 out of 400, heh
looks good :D
as far as I understand Show isn't supposed to be for pretty printing, so adding a type-class of your own is the right thing to do
phew. well, either way this is a learning / for fun project. technically the first piece of haskell code that i'll actually be running a couple of times a day. so thanks again :)
I wish Haskell came with a pretty printing class
you're welcome :D was a fun excercise
Record syntax is so damn busy
considering "pretty" is subjective i don't mind it having it's own typeclass(es). who says everyone likes to see it with ansi codes flaring up their terminal. maybe someone prefers markdown o_^
I don't think it's meant for pretty printing either. It forms a retraction and section with Read. A few simple laws would be read . show = id
there's pretty printing classes on hackage
the problem with pretty printing is everyone wants something different :)
Hey if anyone's interested, there's a functional programming discord server here with lots of Haskell users: discord.me/functionalprogramming
I'm trying to implement MonadBaseControl for my transformer stack, but I'm kind of stuck. The problem is shown here: http://lpaste.net/227445533667491840 with comments containing the type errors I'm getting
Any help is much appreciated!