hpc 2017-01-26 01:47:09
https://hackage.haskell.org/package/JuicyPixels-util-0.2/docs/Codec-Picture-RGBA8.html perhaps
MarcelineVQ 2017-01-26 01:47:17
color space? like an ICC?
hpc 2017-01-26 01:47:31
fromDynamicImage, though it specifically makes it RGBA8
hpc 2017-01-26 01:48:34
ertes: if you can somehow find a good function between color spaces, pixelMap from JuicyPixels as well lets you convert them
hpc 2017-01-26 01:48:56
oh wait you don't even need that other package either, convertRGBA8
hpc 2017-01-26 01:50:07
ooh, https://hackage.haskell.org/package/JuicyPixels-3.2.8/docs/Codec-Picture-Types.html#t:ColorConvertible
ertes 2017-01-26 01:50:12
hpc: the problem is: i don't know the colour space to begin with
ertes 2017-01-26 01:50:22
hpc: sRGB? adobe RGB? …?
hpc 2017-01-26 01:50:23
so you have DynamicImage
ertes 2017-01-26 01:50:49
hpc: i understand JuicyPixels' API… the problem is that it doesn't seem to give me this information
ertes 2017-01-26 01:51:03
"RGB" can mean a lot of things
hpc 2017-01-26 01:51:40
juicy doesn't seem to have a concept of the sRGB space...
hpc 2017-01-26 01:52:00
terrible idea: use imagemagick
ertes 2017-01-26 01:52:12
i think it just loads the component values without even caring about what they mean =/
MarcelineVQ 2017-01-26 01:52:33
it does have gamma metadata, at a glance
ertes 2017-01-26 01:52:34
i should probably report this as a bug, because without this information one can't even write a correct image viewer
MarcelineVQ 2017-01-26 01:53:17
isn't gamma and colorspace often interchangeable terms?
ertes 2017-01-26 01:53:18
MarcelineVQ: yeah, i found that, too, but couldn't really tell whether or how i could use it
ertes 2017-01-26 01:53:41
MarcelineVQ: no, because you also need a reference point
ertes 2017-01-26 01:54:36
in fact most images are encoded in non-linear sRGB, and gamma does not account for this at all
hpc 2017-01-26 02:00:31
imagemagick is looking more and more like a real suggestion :/
hpc 2017-01-26 02:00:56
and yeah, srgba doesn't correspond to any gamma value: http://www.imagemagick.org/Usage/color_basics/#perception
Tuplanolla 2017-01-26 02:05:15
Is working with sockets supposed to be painful?
hpc 2017-01-26 02:05:49
are you listening or connecting?
Tuplanolla 2017-01-26 02:06:09
I'm using `listen` and `accept`.
Tuplanolla 2017-01-26 02:06:50
Exceptions are flying everywhere.
hpc 2017-01-26 02:08:30
ah
hpc 2017-01-26 02:08:57
what exceptions?
ph88 2017-01-26 02:09:05
does anyone know why this parser code seems to loop forever? https://paste.fedoraproject.org/536940/14854361/ I expect DF [DU (CC [])] to be returned for empty input ""
ertes 2017-01-26 02:09:15
Tuplanolla: fortunately haskell lets you use sockets in a sequential manner: just use concurrency
ertes 2017-01-26 02:09:53
Tuplanolla: when the thread quits, consider this a closed connection, when it throws an exception, consider it a connection reset… that distinction is sufficient for 99% of all applications
ertes 2017-01-26 02:10:02
Tuplanolla: the async library makes this particularly easy
Tuplanolla 2017-01-26 02:10:12
Perhaps I shouldn't be reading these man pages too closely.
hpc 2017-01-26 02:10:59
also even though it's discouraged for new users, https://hackage.haskell.org/package/network-2.6.3.1/docs/Network.html#g:3 is actually much easier to use
ertes 2017-01-26 02:11:48
just use something like pipes-network
ertes 2017-01-26 02:11:54
it uses the proper socket API
hpc 2017-01-26 02:12:20
ah good call
Tuplanolla 2017-01-26 02:13:10
Right now I have a main thread and two threads per connection that all share a channel.
Tuplanolla 2017-01-26 02:13:44
It's working fine, but I have this C programmer's paranoia that I forgot to handle a failure mode somewhere.
MarcelineVQ 2017-01-26 02:14:06
ph88: what version of megaparsec is this?
MarcelineVQ 2017-01-26 02:16:07
oh I see new
ertes 2017-01-26 02:19:39
Tuplanolla: worst case: your thread dies
ertes 2017-01-26 02:20:03
Tuplanolla: that's why you should really use async, because threads die silently (from the perspective of your application) by default
ertes 2017-01-26 02:20:21
Tuplanolla: then you can listen on both the channel *and* the thread result using STM
ertes 2017-01-26 02:20:25
Tuplanolla: see waitSTM
Tuplanolla 2017-01-26 02:20:33
Let's take a look.
Tuplanolla 2017-01-26 02:20:39
@hackage async
lambdabot 2017-01-26 02:20:39
http://hackage.haskell.org/package/async
Tuplanolla 2017-01-26 02:22:06
I shall try this. Thanks for the suggestion.
ertes 2017-01-26 02:22:47
Tuplanolla: here is the idiom i typically use: join (atomically (doSomethingWithNextValue <$> readTQueue q <|> either handleConnLost handleConnQuit <$> waitSTM a))
Tuplanolla 2017-01-26 02:24:43
What does it do?
ertes 2017-01-26 02:25:02
doSomethingWithNextValue :: ChanValue -> IO r
ertes 2017-01-26 02:25:08
handleConnLost :: SomeException -> IO r
ertes 2017-01-26 02:25:23
handleConnQuit :: YourThreadResultType -> IO r
ertes 2017-01-26 02:25:59
if there is something on the queue, the first one is run, if the thread died, the second one, if the thread returned normally, the third one
Tuplanolla 2017-01-26 02:26:24
...and `a`?
ertes 2017-01-26 02:26:37
the value 'a' came (ideally) from withAsync
ertes 2017-01-26 02:26:42
less ideally from 'async'
Tuplanolla 2017-01-26 02:26:50
Right.
ertes 2017-01-26 02:27:07
it's of type (Async YourThreadResultType)
merijn 2017-01-26 02:42:22
Ok, I need to develop a trivial GUI that involves 1) sliders, 2) checkboxes and 3) a canvas on which I can draw rectangles interactivel. Recommended libraries?