jle` 2017-02-07 11:45:31
the ! annotation for fields tells ghc that when it does try to figure out the constructor, then also evaluate what it *contains* as well
athan 2017-02-07 11:59:49
Hi everyone. The ARM RTS doesn't accept -N as a parameter; does this mean the ARM GHC targets are all single threaded?
athan 2017-02-07 12:00:18
in terms of green threads, I mean. I see that -threaded is accepted as a compile option though
czcxa 2017-02-07 12:18:15
Hello! I encountered a problem. I am using zlib in my project. The problem is that decompress can throw exception and I want avoid it. I would like to have something like decompress :: ByteString -> Maybe ByteString. Does anybody have any ideas how to achieve this?
jle` 2017-02-07 12:20:01
czcxa: the reason why it's ByteString -> ByteString is because it might not be known that the result is failing until the entire thing is valuated
jle` 2017-02-07 12:20:18
while you can process it chunk-by-chunk up to the point where the error is
johnw 2017-02-07 12:20:26
has anyone created bindings from Haskell to Google's or-tools?
jle` 2017-02-07 12:20:41
any 'ByteString -> Maybe ByteString' implementation would necessarily be non-lazy
hpc 2017-02-07 12:20:46
czcxa: use rnf and evaluate to tie the evaluation back to IO
hpc 2017-02-07 12:20:52
czcxa: and then you can catch the exception normally
jle` 2017-02-07 12:20:57
and load the entire resulting final byetstring into memory
hpc 2017-02-07 12:21:08
(if you don't mind it being in IO)
jle` 2017-02-07 12:21:10
if you're ok with that, you can use the 'spoon' library
hpc 2017-02-07 12:21:22
or use https://hackage.haskell.org/package/spoon
hpc 2017-02-07 12:21:25
lol
jle` 2017-02-07 12:21:26
specifically the 'spoon' function
jle` 2017-02-07 12:21:28
http://hackage.haskell.org/package/spoon-0.3.1/docs/Control-Spoon.html
jle` 2017-02-07 12:22:05
but this does force the entire input to be decompresse and stored in memory before you can ever access even the first byte of the result
jle` 2017-02-07 12:22:56
if you want more fine-grained control, you might have want to look for a pipes/conduit wrapper for zlib, but for simple use cases it might be fine
czcxa 2017-02-07 12:24:44
Hm. I don't need Lazy BS, and wish avoid IO. I know about spoon, I thought there is a better solution...
jle` 2017-02-07 12:25:27
if you don't want a lazy BS, then you're going to have to store the entire result in memory anyway
jle` 2017-02-07 12:25:35
so spoon should work
czcxa 2017-02-07 12:28:43
Good. I'll try to use a spoon. Of course it would be nice if the zlib would provide the function with no exceptions.
czcxa 2017-02-07 12:29:42
Thanks and for help!
jle` 2017-02-07 12:33:46
no problem!
jle` 2017-02-07 12:34:08
yeah, like i said, the no exception approach has some issues, but i suppose it should be left to the user to weigh in on the trade-offs