Search Haskell Channel Logs

Friday, February 10, 2017

#haskell channel featuring alexbiehl, merijn, ezyang, lpaste_, Zowlyfon, tsahyt, and 8 others.

liste 2017-02-09 23:45:33
thatguy: also, http://stackoverflow.com/q/8576795/1283954
thatguy 2017-02-09 23:51:17
does ghc automatically do parallelization?
ezyang 2017-02-09 23:51:53
no
thatguy 2017-02-09 23:52:23
to bad
biglama 2017-02-09 23:59:05
hi guys, yesterday I asked why my parser written with megaparsec was slow and some people told me to try attoparsec instead
biglama 2017-02-09 23:59:12
well, it's even slower !
lpaste_ 2017-02-09 23:59:20
biglama pasted "Slow attoparsec" at http://lpaste.net/352305
biglama 2017-02-09 23:59:31
here is the code if someone is interested
bollu 2017-02-09 23:59:42
stack init is failing
bollu 2017-02-09 23:59:51
at "updating package index"
bollu 2017-02-10 00:00:04
is it picking up proxy settings or something? I just got back from college, so I don't have a proxy here
lpaste_ 2017-02-10 00:00:34
biglama pasted "Profiling slow parser with attoparsec" at http://lpaste.net/352306
biglama 2017-02-10 00:00:37
and here is my profiling
bollu 2017-02-10 00:01:38
lol, nvm, just shitty internet
mpickering 2017-02-10 00:11:48
If I have a javascript function which returns a string. How should I write the JavascriptFFI foreign import? Something like `f :: JSString -> Int -> IO JSString`?
mpickering 2017-02-10 00:16:13
If I do this, console.log shows the right output but then I get a nasty "Cannot read property 'codePointAt' of undefined" when actually trying to use the string in haskell land
tsahyt 2017-02-10 00:19:23
biglama: why are you using text for IO but bytestrings for parsing?
tsahyt 2017-02-10 00:19:39
moreover, strict IO and lazy parsing
tsahyt 2017-02-10 00:20:10
biglama: also instead of your mySep function, look at skipSpace
tsahyt 2017-02-10 00:20:57
although I don't think that this is causing the huge buildup you're experiencing
Zowlyfon 2017-02-10 00:21:17
tsahyt, morning
tsahyt 2017-02-10 00:21:42
hello Zowlyfon
tsahyt 2017-02-10 00:23:13
biglama: disregard the bytestring/text thing, I read that wrong in the import list
systadmin 2017-02-10 00:24:05
hello
Grisha 2017-02-10 00:34:53
hi everyone
biglama 2017-02-10 00:35:15
tsahyt: i'm a bit confused between bytestring and text
Grisha 2017-02-10 00:35:24
ho do I lift Either a b to EitherT a IO b?
biglama 2017-02-10 00:35:57
tsahyt: is it more efficient to read a file with bytestring and process it as Text ?
alexbiehl 2017-02-10 00:36:21
Grisha: try hoistEither from Control.Monad.Trans.Either
Grisha 2017-02-10 00:36:29
i've got a function returning Either a b and would like pipe the result of an IO action into it, obtaining EitherT a IO b as the resulting type
merijn 2017-02-10 00:36:44
biglama: It's simple: Pretend the String part of ByteString doesn't exist
Grisha 2017-02-10 00:36:45
alexbiehl: I'll take a look, thanks a lot
merijn 2017-02-10 00:36:57
biglama: ByteString == Bytes with unfortunate naming for historical reasons
Grisha 2017-02-10 00:37:44
alexbiehl: on a second thought - do you think the the whole constellation smells a bit?
Grisha 2017-02-10 00:37:58
alexbiehl: in theory, I would rather want to abstract IO away
biglama 2017-02-10 00:38:36
merijn: so the readFile from ByteString reads any file format but returns byte ?
biglama 2017-02-10 00:39:01
merijn: btw, this version with attoparsec does not finish :(
dhalgren_ 2017-02-10 00:39:15
would a pipeline like this be reasonably idiomatic, or too pointless? uncurry zip . first (scanl1 (+)) . unzip . map ((uncurry (*)) &&& id) . zip frequency . zipWith (/) candidates $ ...
tsahyt 2017-02-10 00:39:17
biglama: you can think of bytestring as being like [Word8], but obviously with a better internal representation
merijn 2017-02-10 00:39:44
dhalgren_: Written like that? No. But if you split into a bunch of stuff defined in where clause with reasonable names it might
tsahyt 2017-02-10 00:39:45
i.e. it's a string of bytes, but not a string as in "textual data"
dhalgren_ 2017-02-10 00:40:13
thx!
biglama 2017-02-10 00:40:27
tsahyt: okay. So is it better to use readFile from bytestring, than convert to Text ? Or use readFile from Text ?
merijn 2017-02-10 00:40:31
biglama: It's odd that I don't see any major hotspots in the profile. Are you compiling with -O or -O2? Are the libraries compiled with that?
biglama 2017-02-10 00:40:58
merijn: I used -O2, but I'm not sure the libraries are optimized
biglama 2017-02-10 00:41:10
merijn: I used stack build --ghc-options -O2
alexbiehl 2017-02-10 00:41:45
Grisha depends, can you show code?
merijn 2017-02-10 00:41:48
I don't know stack, so can't say if that works :)
Grisha 2017-02-10 00:41:56
alexbiehl: wat a sec
systadmin 2017-02-10 00:42:44
Stack is a RAM killer
biglama 2017-02-10 00:43:49
merijn: I think stack compiled the libraries for profiling at some time but were not compiled again for optimization
Grisha 2017-02-10 00:43:59
alexbiehl: http://lpaste.net/352307
tsahyt 2017-02-10 00:44:49
biglama: stack keeps profiling builds separate