Coder Social home page Coder Social logo

Comments (5)

jdegoes avatar jdegoes commented on July 3, 2024

In fact, I'd argue that at some level, a widget must be able to be wrapped up into a component, so that it can accept and generate messages exactly like a component. Strictly one-way communication will not work for many use cases and will necessitate messy workarounds.

from purescript-halogen.

paf31 avatar paf31 commented on July 3, 2024

I think it should be possible to wrap widgets as components using some kind of helper function.

The tricky part right now is that I'm running into variance issues trying to make Widget into a Functor. The type of the renderer becomes:

HTML p i ~ (i -> Eff eff Unit) -> (p -> Widget eff i) -> VTree

which is invariant in i. Widget essentially has become

type Widget eff i = (i -> Eff eff Unit) -> VTree

which is covariant.

Maybe I've just been staring at this for too long, but I feel like these pieces should be fitting together.

_Edit: inlining p gives

HTML (Widget eff i) i ~ (i -> Eff eff Unit) -> VTree

which is covariant, but this is tricky because of the finally tagless approach.

from purescript-halogen.

jdegoes avatar jdegoes commented on July 3, 2024

which is covariant, but this is tricky because of the finally tagless approach.

Well, finally tagless is subservient to good composable abstractions (IMO), so if it proves an obstacle, we can always go back to initial.

from purescript-halogen.

jdegoes avatar jdegoes commented on July 3, 2024

This ticket should really be retitled, "Widgets should be as powerful as Components".

from purescript-halogen.

paf31 avatar paf31 commented on July 3, 2024

Fixed in #58. The Ace editor example is a good demo of this.

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.