Search Haskell Channel Logs

Tuesday, February 21, 2017

#haskell channel featuring jle`, Cale, lambdabot, halogenandtoast, quchen, ertes, and 7 others.

spatial 2017-02-20 21:45:28
Updates in persistent data structures. What is it ?
suppi 2017-02-20 21:46:21
spatial: this might help https://youtube.com/watch?v=dOy7zIk3IUI
suppi 2017-02-20 21:48:18
also this https://youtube.com/watch?v=GXW1jBijhlk
spatial 2017-02-20 21:48:31
Let me view those videos.
suppi 2017-02-20 21:49:41
there are also other approaches in the purescript world such as in the libraries signal, pux, thermite and halogen
quchen 2017-02-20 21:57:03
ertes: I remember you mentioning reactive-banana was your favourite FRP lib until something else came along. What is this other library called?
ertes 2017-02-20 21:57:41
quchen: reflex
quchen 2017-02-20 21:57:53
Thanks!
quchen 2017-02-20 21:58:28
Okay, looks more complicated.
quchen 2017-02-20 21:59:18
instance Reflex Spider«, hah
Cale 2017-02-20 22:03:16
quchen: Yeah, unless you're really keen to help Ryan work on it, looking at Spider's actual implementation probably isn't too helpful
ezyang 2017-02-20 22:03:44
Well, the fancy rank-2 types in the Spider implementation make the types look more complicated
ezyang 2017-02-20 22:03:50
but if you've done the ST monad before it's not too bad
quchen 2017-02-20 22:03:59
I have.
quchen 2017-02-20 22:04:07
But I find line-long constraints a bit scary.
quchen 2017-02-20 22:04:20
It brings so many definitions into scope that I lose sight of what I can do with things.
quchen 2017-02-20 22:04:42
But ertes endorsement means it's probably worth it :-)
ezyang 2017-02-20 22:04:45
yeah. Fortunately reflex uses a lot of associated types so there's only ever one type parameter
ezyang 2017-02-20 22:05:03
I wish I could say Backpack would make this better... but they still need the phantom parameter T_T
tsahyt 2017-02-20 22:05:33
ertes: what are the benefits of reflex over r-b?
ezyang 2017-02-20 22:06:57
tsahyt: https://www.reddit.com/r/reflexfrp/comments/3c36ya/differences_between_reflex_and_other_frp_libraries/ might say a little
tsahyt 2017-02-20 22:09:26
I guess I'll just have to try it eventually then
ertes 2017-02-20 22:09:37
quchen: the 't' parameter is mostly a dummy argument to select an implementation (reflex is both a semantics (Reflex) and an implementation of it (Spider))
tsahyt 2017-02-20 22:09:38
efficiency is always a good thing
ertes 2017-02-20 22:10:02
quchen: the size of the constraint is unfortunate, but necessary
ertes 2017-02-20 22:10:20
with backpack it would become a lot less scary though
ezyang 2017-02-20 22:10:35
ertes: It's not true though :(
Cale 2017-02-20 22:10:39
At some point we might use the t parameter in some more interesting ways
quchen 2017-02-20 22:10:39
ertes: I think I need to read up on the lib more before understanding sentences like these. I'm only, let's call it »phenomenologically«, familiar with FRP.
ezyang 2017-02-20 22:10:42
Unless you only let one instance of Spider run at a time
Cale 2017-02-20 22:10:46
Timeline transformers :)
halogenandtoast 2017-02-20 22:10:58
Can someone explain to me the "k" in the kind for Const: Const :: * -> k -> *
ertes 2017-02-20 22:11:05
ezyang: it's not? wouldn't backpack basically make the Reflex class vanish and give us Behaviour, Event, PushM, etc. directly?
ezyang 2017-02-20 22:11:08
halogenandtoast: It's kind polymorphic
ezyang 2017-02-20 22:11:20
ertes: So, in my Backpack version of Reflex, indeed the Reflex class goes away
halogenandtoast 2017-02-20 22:11:27
ezyang: thanks, looking that up
ezyang 2017-02-20 22:11:30
but we still need the type parameter two enforce no timeline crossing
ezyang 2017-02-20 22:11:44
halogenandtoast: You can set k = *, and then you have * -> * -> *
Cale 2017-02-20 22:11:48
halogenandtoast: That indicates that any kind can be chosen for k, when you use Const, just like how any type can be used for a type variable.
quchen 2017-02-20 22:11:58
halogenandtoast: k can be * (e.g. Int) or * -> * (e.g. Maybe) or Constraint (e.g. Eq ()) or * -> Constraint (e.g. Eq) or …
ertes 2017-02-20 22:12:02
ezyang: yeah, sure
ertes 2017-02-20 22:12:22
i'm not entirely convinced that multiple timelines are useful, but i haven't really thought about it too much either =)
ertes 2017-02-20 22:12:32
as far as i see the only thing it prevents is global locking
halogenandtoast 2017-02-20 22:12:35
quchen: can't the first * be any of those things as well?
ezyang 2017-02-20 22:12:48
yeah :)
cocreature 2017-02-20 22:12:52
halogenandtoast: it can't be Maybe because Maybe has kind * -> * and not *
ezyang 2017-02-20 22:12:57
well, that's why there's Spider Global
implementation 2017-02-20 22:13:08
quchen: can it also be # (e.g. for Int# ?)
ertes 2017-02-20 22:13:16
Cale: any comments on that?
ezyang 2017-02-20 22:13:49
implementation: yep
ertes 2017-02-20 22:14:56
in particular: timeline transformers? like translating a Pure system into a Spider system?
quchen 2017-02-20 22:15:19
implementation: Just like in the type »a -> a«, »a« can be anything – Int, Bool, Maybe (Int,Bool,Char) – the kind »k« can be anything in »* -> k -> *«.
ezyang 2017-02-20 22:15:21
ertes: Definitely not that, but I'm curious what timeline transformers would be for too ^^
ertes 2017-02-20 22:15:36
ezyang: why not? seems like a reasonable thing to do
ertes 2017-02-20 22:16:01
instead of defining events based on effects, you could have events that occur in certain frames chosen by a formula =)
Cale 2017-02-20 22:16:27
We might be able to systematically change the semantics in various ways, like transforming Events so that they can occur multiple times simultaneously (a la Conal's FRP)
Cale 2017-02-20 22:16:54
Or adding nondeterminism (branching timelines)
implementation 2017-02-20 22:17:10
quchen: just remembered that the # kind had some restrictions when it came to polymorphy
Cale 2017-02-20 22:17:36
I haven't come up with anything too hard-hitting that I'd really like to have yet.
ertes 2017-02-20 22:17:45
that's one thing conal and i disagree on (or at least he seemed to revisit that notion when i told him that multi-occurrence is basically equivalent to events over monoids) =)
Cale 2017-02-20 22:17:51
But there are lots of things one could do by transforming a Reflex implementation.
ezyang 2017-02-20 22:18:22
implementation: Certainly, you can't write a function that is polymorphic on #
ezyang 2017-02-20 22:18:51
Cale: So... when you say timeline transformer, you really mean it in a monad transformer sense?
Cale 2017-02-20 22:18:57
Perhaps eventually there will be a transformer to add a measure to time
Cale 2017-02-20 22:19:09
yeah
Cale 2017-02-20 22:20:34
(though it's quite likely that adding integrals would be better done just by changing the implementation out altogether -- it's not clear the extent to which you'd have to rework everything to *really* make things efficient)
ertes 2017-02-20 22:22:29
Cale: at this point branching is an O(n) copying process, as far as i can tell
ertes 2017-02-20 22:22:41
number of behaviours + number of events
Cale 2017-02-20 22:24:19
Oh, branching is almost guaranteed to be horrible in terms of performance, but it might be interesting if we could introduce it for some kind of exhaustive testing.
sm 2017-02-20 22:25:11
what about elerea ? It seems to be nice and simple and works well in dow
sm 2017-02-20 22:25:43
I mean, http://hackage.haskell.org/package/dow
Cale 2017-02-20 22:26:04
Well, it doesn't have events, which will work for some applications, but it's pretty limiting.
sm 2017-02-20 22:26:41
I see. Then there's http://hackage.haskell.org/package/euphoria which seems to add events to elerea
Cale 2017-02-20 22:27:39
You end up doing various sorts of (somewhat expensive) edge detection to simulate events if you don't have them. I don't know how euphoria works though, hadn't heard of it before.
tsahyt 2017-02-20 22:27:58
I can "zip" Applicatives using liftA2 (,), but can I unzip them as well?
tsahyt 2017-02-20 22:29:50
so basically I'd need Applicative f => f (a,b) -> (f a, f b)
tsahyt 2017-02-20 22:30:59
oh nvm, I don't even need applicative for that of course
tsahyt 2017-02-20 22:31:22
:t fmap fst &&& fmap snd
lambdabot 2017-02-20 22:31:25
Functor f => f (b, b1) -> (f b, f b1)
jle` 2017-02-20 22:31:50
tsahyt: not that that is not necessarily an inverse of liftA2 (,)
sm 2017-02-20 22:32:09
Cale: interesting. I would guess it's somewhat performant since it comes from industry
tsahyt 2017-02-20 22:32:13
jle`: it should be in my case
Cale 2017-02-20 22:32:14
Usually it won't be... thinking of liftA2 as zipping is a bit misleading in some cases
tsahyt 2017-02-20 22:32:28
jle`: I've just been wondering whether I should provide a zip/unzip for my type
tsahyt 2017-02-20 22:32:39
but it can be done in terms of applicative and functor here
Cale 2017-02-20 22:34:45
sm: I'm sure you can do some stuff with it, but I'm less sure about whether it will be competitive with reflex performance-wise :)
sm 2017-02-20 22:35:30
ok. I'd like to see/make a (non-web) game with reflex some time