Search Haskell Channel Logs

Monday, January 30, 2017

#haskell channel featuring jle`, dgpratt, Ptival, lambdabot, ertes, Welkin,

jle` 2017-01-30 15:02:34
haskelllord69: happy haskelling :)
Welkin 2017-01-30 15:03:32
I don't think I've written any haskell in almost 2 months o.o
kadoban 2017-01-30 15:08:42
Sounds terrible
dgpratt 2017-01-30 15:09:09
so I made a little program that runs a system command to generate the response to a web request
Welkin 2017-01-30 15:09:37
yeah... it's not great
dgpratt 2017-01-30 15:09:49
but I'd like to cache the command output for a small time interval
dgpratt 2017-01-30 15:10:06
on the order of seconds
Welkin 2017-01-30 15:10:25
all programming outside of haskell is... shitty
Welkin 2017-01-30 15:10:28
haha
Welkin 2017-01-30 15:10:36
it feels like I've been on a haskell diet
dgpratt 2017-01-30 15:10:47
I'm assuming some multithreading is in order, but beyond that I'm not sure the best direction to proceed, advice anyone?
orzo 2017-01-30 15:10:57
i need a bounded priority queue that will auto-delete the lowest priority element once it reaches a certain size but also give me fast access to the highest priority element and ability to delete it
orzo 2017-01-30 15:11:47
all i've come up with is pairing two priority search queues with opposite prioritization
orzo 2017-01-30 15:13:22
anybody got a better idea?
monochrom 2017-01-30 15:13:23
dgpratt: Consider http://hackage.haskell.org/package/psqueues (priority := timestamp, search key := query or path)
dgpratt 2017-01-30 15:13:49
consider it considered, thanks monochrom
Ptival 2017-01-30 15:13:56
I am having trouble flattening code withing monadic code, see: http://paste.awesom.eu/k7DO
monochrom 2017-01-30 15:14:48
Ptival: Consider Control.Monad.ExceptT. Comes with GHC.
monochrom 2017-01-30 15:16:07
But if it's IO, you may be better off with exceptions, Control.Monad.Exception
Ptival 2017-01-30 15:16:21
monochrom: it is not IO, it's within a free monad
Ptival 2017-01-30 15:16:43
actually not even
Ptival 2017-01-30 15:16:49
I guess it's within an unspecified monad?
monochrom 2017-01-30 15:16:57
Then you should redesign your free monad so that user code does not need to do this case analysis all the time.
Ptival 2017-01-30 15:17:25
it's within an interpreter for a free monad, in an unspecified monad
monochrom 2017-01-30 15:17:31
In other words your free monad and your interpreter should include an exception mechanism.
Ptival 2017-01-30 15:18:05
so should I say that I only interpret within MonadError monads?
monochrom 2017-01-30 15:18:11
No.
Ptival 2017-01-30 15:19:24
ah, let me give you a little more context then
monochrom 2017-01-30 15:19:33
OK I don't know what is "interpreter for a free monad, in an unspecified monad".
Ptival 2017-01-30 15:23:18
monochrom: http://paste.awesom.eu/8iaC here's what it more or less looks like
Ptival 2017-01-30 15:23:42
maybe my separation of TypeCheckerF and Work is unfortunate
Ptival 2017-01-30 15:24:37
though this might be orthogonal to the current problem
Ptival 2017-01-30 15:25:34
so, no, this actually happens within a (FreeT TypeCheckerF m a) computation
orzo 2017-01-30 15:29:41
Ptival: you can use NondecreasingIndentation to nest monad operations without indenting
ertes 2017-01-30 15:31:58
@tell dfeuer i've abandoned the lazy ST FRP idea (too complex) and wrote an RC4 implementation using MonadFix instead: https://gist.github.com/esoeylemez/dd9c98506b25d197dd72e42edb914731
lambdabot 2017-01-30 15:31:59
Consider it noted.
Welkin 2017-01-30 15:33:24
how many of you have heard of the mythical "self-documenting code"?
ertes 2017-01-30 15:33:46
swapping array elements is actually quite convenient with MonadFix… never noticed that
Welkin 2017-01-30 15:34:01
to me it's bullshit
ertes 2017-01-30 15:34:01
doesn't work with unboxed arrays though
Ptival 2017-01-30 15:36:04
orzo: interesting
ertes 2017-01-30 15:41:15
dfeuer: lambdabot has a message for you