nshepperd_ 2017-03-05 05:54:49
Tuplanolla: ALens / cloneLens i guess
Tuplanolla 2017-03-05 05:55:54
Not in Microlens unfortunately.
hexagoxel 2017-03-05 05:59:47
encoding functions of arbitrary arity in a free applicative requires strangely reversed order of effects..
lpaste_ 2017-03-05 06:07:38
hexagoxel pasted "context, just for fun" at http://lpaste.net/353240
hexagoxel 2017-03-05 06:08:00
"<- eqT ->" is such a tease, visually.
Gurkenglas 2017-03-05 06:09:08
hexagoxel, why isnt the "step f rest $" in line 4 instead?
johnw 2017-03-05 06:09:10
why lambdacase and not just two definitions? It would be the same exact size
hexagoxel 2017-03-05 06:10:02
more importantly, i think i can use runAp.
bollu1 2017-03-05 06:10:20
if I have a lens into a small part of my state, how do I set it inside a State monad?
Gurkenglas 2017-03-05 06:10:29
The whole thing looks like just a monadic catamorphism, um, I think the thing that defines free monads?
tsahyt 2017-03-05 06:10:31
I've been puzzling over this for a while now. Given an (r -> (b,d)) -> (r -> (c,d)), I'd like to construct an (r -> b, d) -> (r -> c, d). Is this even at all possible?
Gurkenglas 2017-03-05 06:11:39
:exf ((r -> (b,d)) -> (r -> (c,d))) -> ((r -> b, d) -> (r -> c, d))
tsahyt 2017-03-05 06:11:41
the use case here is that I'm trying to write an ArrowLoop instance for something. I've got one version that type checks, but doesn't work in practice, and since my arrows underneath are just specialized functions, I thought I could reuse the instance for (->) somehow
tsahyt 2017-03-05 06:12:57
@djinn ((r -> (b,d)) -> (r -> (c,d)) -> ((r -> b, d) -> (r -> c, d))
lambdabot 2017-03-05 06:12:57
Cannot parse command
hexagoxel 2017-03-05 06:13:05
@djinn ((r -> (b,d)) -> (r -> (c,d))) -> ((r -> b, d) -> (r -> c, d))
lambdabot 2017-03-05 06:13:05
f a (b, c) =
lambdabot 2017-03-05 06:13:06
(\ d ->
lambdabot 2017-03-05 06:13:06
case a (\ _ -> (b d, c)) d of
lambdabot 2017-03-05 06:13:06
(e, _) -> e,
lambdabot 2017-03-05 06:13:06
c)
tsahyt 2017-03-05 06:13:19
that went quick
Gurkenglas 2017-03-05 06:13:41
*looks on hackage* oh yes runAp, lets race to who gets that implemented :D
tsahyt 2017-03-05 06:14:06
runAp?
tsahyt 2017-03-05 06:16:03
@hoogle runAp
lambdabot 2017-03-05 06:16:06
Control.Applicative.Free runAp :: Applicative g => (forall x . f x -> g x) -> Ap f a -> g a
lambdabot 2017-03-05 06:16:06
Control.Applicative.Free.Final runAp :: Applicative g => (forall x . f x -> g x) -> Ap f a -> g a
lambdabot 2017-03-05 06:16:06
Control.Applicative.Trans.Free runAp :: Applicative g => (forall x . f x -> g x) -> Ap f a -> g a
tsahyt 2017-03-05 06:17:56
is there an offline version of djinn somewhere? I think it could be useful to bind this into vim
hexagoxel 2017-03-05 06:18:19
Gurkenglas: i think i make use of the fact that output is a free monad.
bollu 2017-03-05 06:18:26
how do you deal with State / StateT *without* lens?
hexagoxel 2017-03-05 06:18:28
@hackage djinn
lambdabot 2017-03-05 06:18:29
http://hackage.haskell.org/package/djinn
bollu 2017-03-05 06:18:32
isn't it a pain to set particular fields?
bollu 2017-03-05 06:18:49
I've just started using "lens", and it seems super neat
tsahyt 2017-03-05 06:19:24
thanks
zennist 2017-03-05 06:22:20
quick question: does 'cabal sandbox' uses ghci in its building phase?
hexagoxel 2017-03-05 06:22:37
no
hexagoxel 2017-03-05 06:22:45
it uses ghc.
zennist 2017-03-05 06:22:46
I'm getting build errors which look like ghc is trying to load code into ghci - however there is no *TemplateHaskell* enabled or used in my code
slack1256 2017-03-05 06:24:35
anybody know other blogpost of detecting space leaks at writing time like the ones from ezyang?
johnw 2017-03-05 06:25:36
you've read Neil's right?
slack1256 2017-03-05 06:25:57
yep, his trick is the best I know for detecting leaks at runtime
slack1256 2017-03-05 06:26:15
yet my confidence falters that I don't have a good model for writing time
johnw 2017-03-05 06:26:24
oh, writing time
Gurkenglas 2017-03-05 06:27:03
(Oh hey hexagoxel uses f for step so it's a little more tangled but I guess I'll try extracting the recursion scheme)
slack1256 2017-03-05 06:27:14
(I got this app that has a event loop for network events, runtime testing requires mocking stuff and I want to avoid it)
johnw 2017-03-05 06:30:59
it's hard to always know, but things to look out for: (1) calling other functions within a "case", (2) thunks whose result is much smaller than the data they're computed from, (3) creating structures whose spine is strict, but whose contents are not, (4) using tuples too much (very typical way of causing thunks to occur in places where they might not otherwise, as a special case of #3), (5) recursion from within a lambda, (6) expecting
johnw 2017-03-05 06:30:59
State s to be strict in 's', ...
slack1256 2017-03-05 06:36:29
I've been thinking the relationship between the call and the called lately. A big problem is that how memory depends in the intereaction between the two, the cost model is not local
slack1256 2017-03-05 06:36:51
but we can make this simpler if we restrict the functions allowed to `call`
slack1256 2017-03-05 06:37:15
this would be like okasaki analysis of queue being restricted to certain functions
slack1256 2017-03-05 06:37:22
yet I don't know if this is naive
ph88 2017-03-05 06:40:19
maybe stupid question but when i have list in the form of tuples of 2, so (elem1, (elem2, ()) then how do i find the last occurance of a value ?
johnw 2017-03-05 06:41:14
ph88: You'd need to encode this pattern as a data type, so that you can make use of type recursion, and then write a recursive function
slack1256 2017-03-05 06:41:15
ph88: actually that is a great idea, that exactly is what the Free ADT does
johnw 2017-03-05 06:41:52
well, and lists
johnw 2017-03-05 06:42:02
since what he wrote is the same as Free ((,) a) () ~ [a]
johnw 2017-03-05 06:42:18
ph88: I don't understand
ph88 2017-03-05 06:43:06
johnw, well let's say i have (1, (3, (2, 0))) and i want to change the highest number to 10
johnw 2017-03-05 06:43:26
why do you want to encode a list like this?
ph88 2017-03-05 06:43:37
this is about GHC.Generics
ph88 2017-03-05 06:43:48
:*:
ph88 2017-03-05 06:44:54
so maybe one function that traverse over the list and gives me the index of the highest number, and then another function to traverse again and give back the same list with the number at the index changed to 10 ?