Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Activity
  • Jun 22 06:58
    dependabot[bot] labeled #95
  • Jun 22 06:58
    dependabot[bot] opened #95
  • Jun 22 06:58

    dependabot[bot] on npm_and_yarn

    Bump ws from 5.2.2 to 5.2.3 Bu… (compare)

  • Jun 22 06:58

    paldepind on npm_and_yarn

    (compare)

  • Jun 22 06:57

    paldepind on master

    Bump glob-parent from 5.1.0 to … Merge pull request #94 from fun… (compare)

  • Jun 22 06:57
    paldepind closed #94
  • Jun 10 11:07
    dependabot[bot] labeled #94
  • Jun 10 11:07
    dependabot[bot] opened #94
  • Jun 10 11:07

    dependabot[bot] on npm_and_yarn

    Bump glob-parent from 5.1.0 to … (compare)

  • Jun 09 10:29
    dependabot[bot] labeled #93
  • Jun 09 10:29
    dependabot[bot] opened #93
  • Jun 09 10:29

    dependabot[bot] on npm_and_yarn

    Bump normalize-url from 4.3.0 t… (compare)

  • Jun 09 03:15
    dependabot[bot] labeled #137
  • Jun 09 03:15
    dependabot[bot] opened #137
  • Jun 09 03:15

    dependabot[bot] on npm_and_yarn

    Bump normalize-url from 4.5.0 t… (compare)

  • Jun 07 22:27
    dependabot[bot] labeled #136
  • Jun 07 22:27
    dependabot[bot] opened #136
  • Jun 07 22:27

    dependabot[bot] on npm_and_yarn

    Bump trim-newlines from 3.0.0 t… (compare)

  • May 28 19:23
    dependabot[bot] labeled #135
  • May 28 19:23
    dependabot[bot] opened #135
Simon Friis Vindum
@paldepind

what are some of the differences between this lib and Sodium ?

I'm not super familiar with Sodium but here are some differences:

  • Our semantic for behavior is identical to classic FRP. The semantics of Sodiums Cell does not support continuous time which is a cornerstone of classic FRP. Hareactive supports continuous time.
  • I'm not sure if behaviors are monads in Sodium. They are in Hareactive.
  • In Hareactive stateful behaviors are created through a type called Now. I think it's similar to Sodium's Reactive but I don't think they're completely the same either.\
  • In Sodium the function to merge two streams takes a function as well. In Hareactive it doesn't.
  • Hareactive has Future which is essentially a Stream of one value.
David Komer
@dakom
Re: Varyings - it’s used to pass a value from the vertex shader to fragment shader - here you can see it used in the shader code on the MDN tutorial to use color: https://developer.mozilla.org/en-US/docs/Web/API/WebGL_API/Tutorial/Using_shaders_to_apply_color_in_WebGL
 varying lowp vec4 vColor;
Re: Sodium - Cell does support continuous time afaik, though there was discussion about changing it into two primitives, one for Continous and one for not… I’ll try to dig up that discussion one sec
Simon Friis Vindum
@paldepind
Looking at the semantics for Cell it certainly looks to be inherently discrete.
David Komer
@dakom
Here is the discussion on the Typescript implementation of Sodium: SodiumFRP/sodium-typescript#46
Simon Friis Vindum
@paldepind
Yes, exactly :smile:
David Komer
@dakom

I can’t really read Haskell properly (yet), and no doubt you know your stuff here… but just to talk it out a bit-

Cell a—A value that changes over time, equivalent to Conal’s Behavior

?

Simon Friis Vindum
@paldepind
billede.png
The classic semantic for behavior is Time -> A i.e. a behavior of an a is equivalent to a function from time to an A. In Sodium it is instead a list of values. But a list cannot express anything that is continuous.
Consider for instance the behavior in the picture here: https://github.com/funkia/hareactive#behavior
That graph can be represented as a function from time to a value but it cannot be represented as a list of values.
David Komer
@dakom
C a is different than Cell a though, no? i.e. he specifies a steps function that takes a Cell a and gives a C a
though I really don’t know what a semantic domain is… hehe
Simon Friis Vindum
@paldepind
This makes the classic semantic more powerful.

C a is different than Cell a though, no?

Yes, indeed. Because it's in the semantic domain.

For any Cell a the function steps relates it to it's semantic representation. But, this still means that the definition of C a must fully describe Cell a.
So, in Sodium we have C a = (a, [(T, a)]) but in classic FRP (and in Hareactive) we have C a = T -> a.
Only the later definition is powerful enough to express continuous behaviors (where continuous behaviors are behaviors that change infinitely often).
David Komer
@dakom

I wish I could debate this out - but I don’t have the prerequisite knowledge… I would love it if you’d bring it up on Github… or should I bring it up and ping you?

What I can say is ancedotally he uses continuous time as a “selling point” of FRP (including sodium) and does believe it to be important. And I just noticed he made a little mini golf demo using that idea in Typescript: https://github.com/SodiumFRP/mini-golf

e.g.

A typescript implementation of a FRP-based mini golf demonstrating continuous time.

I really appreciate your handholding a bit here - and for building this library… I love coding this way and want to get more into functional/reactive/frp stuff… sorry if I can’t contribute much aside from the userland story ;)
Though from that perspective, understanding more detail of why I might want to switch from Sodium to hareactive for my next project is super helpful (I’m too locked in to switch for my current project)
Simon Friis Vindum
@paldepind
As far as I can see the mini-golf example doesn't use FRP to drive the time based things. this line looks like a manual event loop.

I really appreciate your handholding a bit here - and for building this library… I love coding this way and want to get more into functional/reactive/frp stuff… sorry if I can’t contribute much aside from the userland story ;)

That is super useful as well! Thank you for asking questions. What are you using FRP for? Have you seen our framework Turbine?

David Komer
@dakom
Ah - no I believe it’s just sampling the current value at that time for animation. Drawing in continuous time isn’t possible..
Haven’t seen Turbine… will take a look. Right now for the dayjob I’m just using FRP basically in place of Redux and to hold app state, as a separate thing from ui state, if that makes sense… though pretty much all the interesting logic runs through that pipeline (I guess UI is interesting too… but…)
Simon Friis Vindum
@paldepind
Here is a link to Turbine: https://github.com/funkia/turbine

Drawing in continuous time isn’t possible..

True, but with FRP and continuous time we can get the illusion of drawing in current time.

David Komer
@dakom
Right, so I believe that’s what it’s doing… at a high level:
  1. Ball position is a Behavior/Cell in continuous time
  2. Ball position is affected by Streams that fire at discrete times (e.g. hitting a wall)
  3. Ball is drawn at an arbitrary rate… if the machinary would support it, this would be in continuous time as well. In the demo there’s actually a slider to mimic from 0->60fps
Simon Friis Vindum
@paldepind
Btw, I've written a blog where I do my best to explain FRP from the ground up in a beginner friendly manner and by using TypeScript. I give many examples where continuous time is used to create animations. It may be of interest to you. You can read it here: http://vindum.io/blog/lets-reinvent-frp/
David Komer
@dakom
Hah, yeah - I emailed that to myself to read later… if you look on the sodium list, embarassingly it’s filled with me asking a ton of questions to just understand all this stuff, largely because I haven’t learned Haskell and almost all the documentation I’ve found assumed Haskell knowledge. So when I saw your article I was thrilled! Looking forward to sitting with it later
Turbine looks pretty cool too - though for DOM/HTML stuff I’m happy with React for now
I’ve landed on an approach which isn’t too awful - basically top-level containers are class components that hold FRP, and then when the FRP changes React calls a setState and from there on it’s stateless/functional. Not the best thing ever, but it’s not too bad either
Simon Friis Vindum
@paldepind

Looking forward to sitting with it later

Sounds awesome! If you read it I'd love to hear what you think about it and if there's anything I can improve.

David Komer
@dakom
:+1:
David Komer
@dakom
posted your question at SodiumFRP/sodium#155 - hope that’s okay
Victor
@vrobinson
@paldepind Just read your ‘Let’s reinvent FRP’ post. Great article. Then visited ‘Posts’ at the top to see what else you’ve written. I’m finding all your articles very informative. However, I only saw three articles listed and ‘Let’s reinvent FRP’ wasn’t among them, despite being dated between your other posts. Do you have any more hidden gems I can read? Or a more complete list of your posts?
Antti Niemenpää
@niant
Hey, I was wondering if sinkStreamand sinkBehavior are intended for public API to use on Hareactive? Those are not mentioned in the readme file, but can be found in the tests for example.
NightYoshi370
@NightYoshi370_twitter
Hey, I was wondering if someone can take a look at this: funkia/list#81
Kurt Milam
@kurtmilam

@NightYoshi370_twitter do these (function and method) solutions work for you?

const random = function (l) {
  return nth(Math.floor(Math.random() * length(l)), l)
}

List.prototype.random = function () {
  return nth(Math.floor(Math.random() * length(this)), this)
}

You can see them in action here .

NightYoshi370
@NightYoshi370_twitter
it works
Thank you
Aldwin Vlasblom
@Avaq
Hi! I stumbled upon Funkia while trying to find a List monad for JS. It looks like a cool project! But sadly I didn't see a Monad Transformer for Funkia's list, which is what I'm looking for. Any chance I missed it, or that there's a community implementation? :)
Mike Panciera
@averagehat
How would I get the last N elements of a stream?
this would be equivalent to take(N) in Rx implementations
I'm asking about hareactive's Stream
Mike Panciera
@averagehat
on a related note, I am working on input buffering (so filtering out or changing inputs based on previous ones) if anyone knows a relevant example.
And finally I am wondering if hareactive shares its naming conventions with any other FRP libraries (which might have more documentation). The problem I am having is the examples use the high-level combinators extensively which are difficult to understand for the unexperienced. I wanted to highlight this tutorial again: http://vindum.io/blog/lets-reinvent-frp/ and mention to @paldepind that this tutorial is not listed on your website (under blogs or anywhere else) and it is really great. It took me a long time to find it. I also suggest it could be linked from the hareactive/turbine READMEs if it is not already