tibbe 2017-02-09 11:45:23
qmm, http://hackage.haskell.org/package/cassava-0.4.5.1/docs/Data-Csv.html#g:5
samcal 2017-02-09 11:45:25
I need some help, I'm trying to represent an AST for a toy language with a GADT
monochrom 2017-02-09 11:45:36
HashMap would require you to specify a thousand keys.
monochrom 2017-02-09 11:45:56
But I guess if there is a header you're done.
samcal 2017-02-09 11:45:57
everything was going well until I tried to add lambda functions
tibbe 2017-02-09 11:45:59
monochrom, no, you ask cassava to return each row as a HashMap
tibbe 2017-02-09 11:46:14
monochrom, hmm
tibbe 2017-02-09 11:47:04
>>> decodeByName "name,salary\r\nJohn,27\r\n" :: Either String (Header, Vector Person)
tibbe 2017-02-09 11:47:04
Right (["name","salary"],[Person {name = "John", salary = 27}])
tibbe 2017-02-09 11:47:13
monochrom, ^^^ there you don't have to specify what the header is
tibbe 2017-02-09 11:47:19
qmm ^^^
merijn 2017-02-09 11:47:42
MarcelineVQ: Ok, so now it compiles and looks a bit nicer, but still not really happy with it: http://lpaste.net/6298367134955208704
tibbe 2017-02-09 11:47:50
sorry, replace Person with Vector ByteString
monochrom 2017-02-09 11:48:06
Someone handwrote a Person type for that to work. The Person type for qmm would contain 1000 handwritten fields.
tibbe 2017-02-09 11:48:16
decodeByName "..." :: Either String (Header, Vector (Vector ByteString))
tibbe 2017-02-09 11:48:42
then update first value in vector and decode out again
tibbe 2017-02-09 11:48:46
encode*
Tuplanolla 2017-02-09 11:59:58
I put all this effort into foreign crap to get raw sockets and now the kernel says "socket: protocol error (Protocol not supported)". Nice.
Tuplanolla 2017-02-09 12:00:24
The same thing happens with the equivalent C code too.
monochrom 2017-02-09 12:00:49
dmwit, jle`: Regarding "rs :: (RandomGen g, Random a) => g -> [a]; rs g = val:rs g' where (val, g') = random g" again, there is a middle ground of NoMR and yet MonoLocalBinds.
jle` 2017-02-09 12:01:36
monolocalbinds sounds like a good idea
jle` 2017-02-09 12:01:50
oh wow it's a real thing, i didn't know this :o
glguy 2017-02-09 12:02:09
MonoLocalBinds gets turned on as a dependency of other extensions
glguy 2017-02-09 12:02:14
You might use it more than you know
monochrom 2017-02-09 12:02:34
IIRC GADTs implies it. Is that right?
glguy 2017-02-09 12:02:54
It's slightly tricky, it's only monolocalbinds for binds that couldn't be lifted out of that scoped
glguy 2017-02-09 12:02:56
scope*
glguy 2017-02-09 12:03:14
Yes, GADTs turns it on
glguy 2017-02-09 12:03:28
TypeFamiles will, too
jle` 2017-02-09 12:04:12
hm
jle` 2017-02-09 12:04:32
so it sounds like the ideal set-up in ghci should be NoMonomorphismRestriction, MonoLocalBinds
markjn1984 2017-02-09 12:07:47
leave
monochrom 2017-02-09 12:08:00
come back
MarcelineVQ 2017-02-09 12:08:24
stay
jle` 2017-02-09 12:09:00
flashbacks to Two Towers come up
babooOn 2017-02-09 12:13:37
if i have a function that takes a string and spits it into multiple string lists, how do i access one particular? for example parse :: String -> [[String]] and parse s = splitOn " ", how can i access the difrerent lists afterwards [[String1][String2]..] ?
monochrom 2017-02-09 12:14:22
If you know "I want the 10th string", you can use !! 11
monochrom 2017-02-09 12:14:27
err, !! 9
MarcelineVQ 2017-02-09 12:14:42
@tell merijn your doQuery looks a lot like a manual version of onException since you're rethrowing. let doQuery = queryGame qsem l `onException` mapM_ leftover l
lambdabot 2017-02-09 12:14:42
Consider it noted.
monochrom 2017-02-09 12:14:45
Else, you will have to say what you want it for.
monochrom 2017-02-09 12:15:30
If you want to stay general, then: You have a list. Use any list-processing functions.
babooOn 2017-02-09 12:16:21
monochrom use it where?
babooOn 2017-02-09 12:16:31
in the same function=
monochrom 2017-02-09 12:16:48
You like to stay general, eh?
monochrom 2017-02-09 12:16:54
Use it where you need it.
tikhon 2017-02-09 12:17:38
What does the number of bytes printed by :set +s in GHCi mean? Is it the total amount of memory allocated?
hpc 2017-02-09 12:18:01
yes
hpc 2017-02-09 12:18:30
it's not the maximum memory consumption, just the sum of all allocations
tikhon 2017-02-09 12:18:37
okay, that's what I was wondering
tikhon 2017-02-09 12:18:38
thanks
MarcelineVQ 2017-02-09 12:18:49
tikhon: more here https://downloads.haskell.org/~ghc/latest/docs/html/users_guide/runtime_control.html#rts-options-to-produce-runtime-statistics
tikhon 2017-02-09 12:19:36
yeah, I'm comparing the stats reported by +RTS -s with what GHCi gives me, but I didn't know which number to compare to
MarcelineVQ 2017-02-09 12:19:43
possibly too much more, I was hoping for a ghci summary note in there too hehe
tikhon 2017-02-09 12:19:58
I'm having an odd problem where my code finishes faster and allocates much less from GHCi than it does as an executable.
tikhon 2017-02-09 12:20:25
I've never run into that before, so I don't have much of an idea on how to debug it.
Jello_Raptor 2017-02-09 12:22:17
Hmm, is it possible to use type families (or data families?) as parameters to a typeclass? Like this http://lpaste.net/352289 ? I've got what amounts to a set of data structures with basically identical constructors but separate inner types, and would like to share the constructors if possible.
hpc 2017-02-09 12:24:40
Jello_Raptor: looks like you can't and there's a specific error message for it
hpc 2017-02-09 12:24:41
test.hs:14:10: error:
hpc 2017-02-09 12:24:41
• Illegal type synonym family application in instance: Bar a
hpc 2017-02-09 12:24:41
• In the instance declaration for 'Quux (Bar a)'
hpc 2017-02-09 12:24:49
(class Quux a where)
babooOn 2017-02-09 12:27:44
can someone give me a hint why on line 6 if the y input = 0, it = getAllMoves s (x-1) 8 color ? (field is 8x8) http://lpaste.net/352291
Jello_Raptor 2017-02-09 12:28:45
hpc: oh? also that's not what i get when i fox the example a bit more http://lpaste.net/352289
Jello_Raptor 2017-02-09 12:29:25
it's complaining that the we need to apply the type family when we use it as a parameter to the datatype
Jello_Raptor 2017-02-09 12:29:41
which would mean it has kind * rather than * -> * like I want
Jello_Raptor 2017-02-09 12:30:40
Functors and other normal datatypes with kind `* -> *` work fine in similar situations :/
Jello_Raptor 2017-02-09 12:37:38
hpc: huh, replacing the type family with a data family works fine, but adds a pile of constructors I don't want to deal with.
qmm 2017-02-09 12:43:34
monochrom and tibbe: thank you both! (sorry for the lack of responsiveness over here)
monochrom 2017-02-09 12:43:59
You're welcome