Search Haskell Channel Logs

Monday, January 30, 2017

#haskell channel featuring ocharles, opqdonut, lyxia, merijn, benneh, nickager, and 6 others.

merijn 2017-01-29 23:45:14
Seems extremely rare you'd get ASCII JSON
merijn 2017-01-29 23:45:20
most JSON on the web is utf8
reactormonk 2017-01-29 23:45:32
Ok, Text it is
merijn 2017-01-29 23:45:45
Of course no one bothered to define what the proper encoding of JSON *should* be, because everyone involved with the web apparently likes pain
opqdonut 2017-01-29 23:45:49
right, for that sort of stuff I'd just use Text
reactormonk 2017-01-29 23:46:04
How do I pick a lens library?
opqdonut 2017-01-29 23:46:19
perhaps combined with some validation that checks that there aren't any nasty characters
merijn 2017-01-29 23:46:24
reactormonk: Additionally, utf8 has the nice property that if your text (through sheer luck) is only ascii the utf8 encoding is the same as ascii
reactormonk 2017-01-29 23:46:36
merijn, but Text isn't utf8?
merijn 2017-01-29 23:47:27
reactormonk: Text is unicode codepoints, and how they are stored internally isn't really relevant. You need to explicitly encode Text to whatever encoding you need when writing to a file/network
merijn 2017-01-29 23:47:47
reactormonk: Using, for example 'encodeUtf8 :: Text -> ByteString'
merijn 2017-01-29 23:48:19
Slightly related, just to clarify things, the name 'ByteString' is a ridiculous historical accident and you should pretend the type is really called 'Bytes'
benneh 2017-01-29 23:59:55
http://lpaste.net/351789 <- does this function exist anywhere already?
opqdonut 2017-01-30 00:03:39
benneh: isn't that just runState?
opqdonut 2017-01-30 00:04:01
hmm right but there might be a big transformer stack in the way
orzo 2017-01-30 00:04:23
there seems to be a pattern synonyms bug that causes the non-exhaustive pattern match warning
merijn 2017-01-30 00:04:37
orzo: Which version of GHC?
orzo 2017-01-30 00:04:46
8.0.1
orzo 2017-01-30 00:05:04
i have pattern k :-> p <- (k,p,())
benneh 2017-01-30 00:05:11
opqdonut: they are similar, but not the same
orzo 2017-01-30 00:05:12
but when i match it, i get a warning
merijn 2017-01-30 00:05:15
orzo: As far as I know the exhaustive checking of pattern synonyms isn't completely finished yet
cocreature 2017-01-30 00:05:26
I think it will be in 8.2
orzo 2017-01-30 00:05:53
probably it should default to no-warning if it doesn't know
merijn 2017-01-30 00:05:57
orzo: So it's not a bug, as much as, this wasn't finished yet
merijn 2017-01-30 00:06:05
orzo: No, that'd be horrible
merijn 2017-01-30 00:06:33
orzo: You can easily silence the warning and the last you thing want is it silently not warning about a pattern that actually isn't exhaustive
orzo 2017-01-30 00:07:18
if i silence the warning by addin ganother match case, i'll get a new warning about it being redundant later when the exhaustiveness check is done
orzo 2017-01-30 00:07:29
heh
orzo 2017-01-30 00:08:00
plus it's code clutter
merijn 2017-01-30 00:08:56
orzo: Well yes, you get a redundant warning once it's finally fixed and then you can safely delete it. The other alternative is not giving a warning if the case could be non-exhaustive and you wind up getting paged at 4:30 AM because your code crashed on a missing pattern
tarragon 2017-01-30 00:33:53
hei
tarragon 2017-01-30 00:34:00
I recently installed pandoc
tarragon 2017-01-30 00:34:26
and I want to file a bug
cocreature 2017-01-30 00:36:09
tarragon: the pandoc bucktracker is on github https://github.com/jgm/pandoc/issues
tarragon 2017-01-30 00:36:39
is not really pandoc, because I realized pandoc is entirely coded with haskell
tarragon 2017-01-30 00:37:02
there's a particular dependency that irked me. At first I could'nt believe my eyes!
tarragon 2017-01-30 00:37:13
I thought it was a spelling error or something.
ocharles 2017-01-30 00:37:15
Does anyone know about the thread safety of IOVectors? Should I wrap them in an MVar if I'm going to operate on them concurrently?
cocreature 2017-01-30 00:39:16
ocharles: I just found this https://stackoverflow.com/questions/19967421/safe-parallel-use-of-mvector-iovector-from-haskell-vector-package suggesting that they are thread safe
ocharles 2017-01-30 00:39:43
cocreature: terrific. Thank you!
cocreature 2017-01-30 00:40:52
ocharles: it looks like it boils down to whether MutableArray# is thread safe
ocharles 2017-01-30 00:41:02
Yea, that seems to be the only mutable variable
nickager 2017-01-30 00:41:44
Hi, I'm parsing some CSV using http://hackage.haskell.org/package/cassava-0.4.5.1/docs/Data-Csv.html#v:decode It seems that only way to know that the `decode` API expects a lazy ByteString is by looking at the source (the Hackage documentation just shows `ByteString`). However IIUC https://wiki.haskell.org/Maintaining_laziness, indicates that as `decode` returns `Either String (Vector a)` then "This function cannot be lazy, because when you access the firs
nickager 2017-01-30 00:41:44
character of the result, it must already be computed, whether the result is Left or Right". So ... is `decode` gaining anything by expecting a lazy ByteString rather than the non-lazy ByteString?
MarcelineVQ 2017-01-30 00:41:46
what do you mean by threadsafe for your use?
cocreature 2017-01-30 00:42:06
tarragon: if you have some specific question or problem, just ask :)
lyxia 2017-01-30 00:42:50
nickager: you can see that the ByteString type in the signature links to ByteString.Lazy
nickager 2017-01-30 00:43:29
@lyxia thanks I missed that
lambdabot 2017-01-30 00:43:29
Unknown command, try @list
tarragon 2017-01-30 00:44:37
why was haskell chosen for pandoc?
lyxia 2017-01-30 00:45:02
nickager: a lazy bytestring doesn't need to be in memory all at once to be consumed.