Squarism 2017-03-04 14:49:26
What i. Have per-game type parameterized "GameServerInstance m1 m2". The hard part is storing these values (of different type arguments) together in an MVar
Squarism 2017-03-04 14:49:44
gah
Squarism 2017-03-04 14:50:13
correction
Squarism 2017-03-04 14:50:14
What I want to accomplish is having per-game typ parame....
ertes 2017-03-04 15:02:36
Squarism: without going through all of your code: the dependent-map library might be interesting
ertes 2017-03-04 15:02:57
it allows value types to be given by the key
Squarism 2017-03-04 15:04:11
oh ok
okeuday_bak 2017-03-04 15:08:44
If you use runPutM from https://hackage.haskell.org/package/binary-0.8.4.1/docs/Data-Binary-Put.html how is the result of type a provided?
Squarism 2017-03-04 15:23:50
Just a hint - in 25 lines of java code what i want to accomplish in haskell : http://lpaste.net/353225
Zemyla 2017-03-04 15:23:52
Okay, so this typechecks, but what the heck does it represent?
Zemyla 2017-03-04 15:23:57
:t ContT mfix
lambdabot 2017-03-04 15:23:59
MonadFix m => ContT a m a
ertes 2017-03-04 15:26:01
Squarism: too much noise… what does that code do that appears difficult to do in haskell?
Squarism 2017-03-04 15:27:33
ertes, the hard part is having an MVar that accepts map elements of a type with different type arguments
ertes 2017-03-04 15:27:48
Squarism: explain the problem, not the solution
ertes 2017-03-04 15:29:02
in other words: explain what you're trying to do without using the words "MVar", "Map" or "type"
Squarism 2017-03-04 15:30:43
the problem is storing a map of GameServerInstance m1 m2 - where m1,m2 can be different for different keys + retrieving values from the same map with their original type arguments
ertes 2017-03-04 15:30:55
you're still explaining the solution
Squarism 2017-03-04 15:32:53
problem - i want to be able to store and retrieve parameterized type values - where type parameters can be different.
Squarism 2017-03-04 15:33:25
cannot put it any shorter than that
ertes 2017-03-04 15:34:12
no, that's still part of the solution… you seem to be trying to translate a java solution to a problem into haskell, which is a recipe for sadness… what *problem* does it solve? just pretend that i'm not a programmer, then explain what you're trying to achieve
ertes 2017-03-04 15:34:42
you want your program to do *something*… what?
Squarism 2017-03-04 15:37:27
remember my game. It mutated to become driven by messages. In and out messages. I have working thread / network code for it and all. Now i want to generify that code to accept games of different messaging models. Each game has its own in and out message types.
ertes 2017-03-04 15:38:30
do the games communicate with each other, or are you just trying to run multiple servers in a single application?
Squarism 2017-03-04 15:38:56
The server kept a store of games (in an MVar) that relied on these messages - thats dependency needs to go imho.
Squarism 2017-03-04 15:39:24
no the games do not communicate
ertes 2017-03-04 15:39:35
what's the map for?
Squarism 2017-03-04 15:40:23
keeping track of : gameid <-> (channels involved in a game)
Squarism 2017-03-04 15:40:34
...that is used for lookup when clients connect
Squarism 2017-03-04 15:40:51
...so the right channels are given to them'
ertes 2017-03-04 15:41:00
a client connects… how does the server know which game to associate it with?
Squarism 2017-03-04 15:41:22
client connects with a gameId.
ertes 2017-03-04 15:42:12
so in principle all your map needs to contain is a mapping from game ids to whatever mechanism is necessary for the game server to communicate with the client
ertes 2017-03-04 15:42:29
in particular it doesn't need to know the precise message type… all it needs to know is how to encode/decode
Squarism 2017-03-04 15:42:30
yep
Squarism 2017-03-04 15:42:42
well
ertes 2017-03-04 15:43:03
so the map is really a map to encoders and decoders, not to a "game instance"
Squarism 2017-03-04 15:43:13
yes
Squarism 2017-03-04 15:43:27
encoders/decoders that is
ertes 2017-03-04 15:43:45
insisting on a concrete manifestation of "game instance" is an OO concept… you may want to get rid of that habit =)
Squarism 2017-03-04 15:44:10
ill think of that =D