Coder Social home page Coder Social logo

Comments (8)

paf31 avatar paf31 commented on July 22, 2024

I think it is.

EventHandler (Aff eff input) is inhabited by preventDefault $> x. All we need is for x to not call the callback, but I'm not sure if that's possible. @jdegoes ?

from purescript-halogen.

jdegoes avatar jdegoes commented on July 22, 2024

Aff eff input is a computation which must produce an input or end in error, there are no other options. It's exactly like Eff eff input except asynchronous. However, one use forkAff if one wishes to fork the computation, and then const-map it to whatever. That should be enough to build this, right? Also Handler is becoming a monad transformer, isn't it?

from purescript-halogen.

paf31 avatar paf31 commented on July 22, 2024

I think @cryogenian wants to not produce any input to the state machine at all. I think handler' will let you do that. The underlying representation of a handler certainly allows it.

from purescript-halogen.

jdegoes avatar jdegoes commented on July 22, 2024

Perhaps a combinator, then, which operates on EventHandler a, goes to EventHandler b for all b, by mapping the Maybe i to Nothing?

from purescript-halogen.

paf31 avatar paf31 commented on July 22, 2024

It's not EventHandler, it's the attribute itself:

https://github.com/slamdata/purescript-halogen/blob/master/src/Halogen/HTML/Attributes.purs#L147

But yes, a combinator would probably do the trick. Rolling the Maybe into the new EventHandlerT would probably be a good thing.

from purescript-halogen.

paf31 avatar paf31 commented on July 22, 2024

@cryogenian Now you can use cancel if you don't want to generate any input event.

@puffnfresh You mentioned using Free which I think was a good idea, but I stuck with WriterT because I now need to turn this into EventHandlerT (transformer) and we don't have a free monad transformer yet in purescript-free.

from purescript-halogen.

puffnfresh avatar puffnfresh commented on July 22, 2024

@paf31 that's fine.

We were not able to write a stack-safe FreeT in Scala due to the JVM. I wonder if JS will have the same problem...

from purescript-halogen.

paf31 avatar paf31 commented on July 22, 2024

Can't you play the same trick with Gosub? Interpreting the monad should (and I'm guessing obviously) be possible safely with tailrec.

from purescript-halogen.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.