-
Notifications
You must be signed in to change notification settings - Fork 71
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
instance Monad Behavior #101
Comments
Semantically, a Monad instance for The problem appears when looking at the Also, looking at the type of By the way, as soon as you drop the requirement of having a That said, I'm happy to explore what benefits a Monad instance for Behavior would entail. Could you give examples where you feel that it's hard to do without? |
You know, you're right that I might just be wanting the However, there is one place where I'm stacking That said, I still think we should try really hard to find this instance, and there is one benefit that is hard to ignore: the syntactic benefit. Syntactically, working with |
Well, I fear it will come at a price, though. For example, in hindsight, one of the first uses of Applicative Functors was in the context of parser combinators. Swierstra et al had to take a step back from the monadic interface in order to devise combinators that can parse LL(1) grammars efficiently [pdf]. They write:
While it may be possible to implement a By the way, the problem of time leaks in FRP falls into a similar category: Yes, it's possible to implement both
with these types, and it's very convenient syntactically, but it's impossible to do so efficiently. One has to give up one of the type signatures, for instance by using Could you give a concrete example of the API that a |
Will get to your other comments later today, but
Here's an example - it's all very work-in-progress at the moment. div_ (style_ (do CSS.position CSS.fixed
CSS.height (100 CSS.@@ CSS.pct)
CSS.width (100 CSS.@@ CSS.pct)
CSS.zIndex 9
CSS.top (0 CSS.@@ CSS.px)
CSS.left (0 CSS.@@ CSS.px)
"opacity" -: fmap (fromString . show) overlayOpacity
"background-color" -: "rgba(0,0,0,0.541)"
"transform" -: "translateZ(0px)"))
mempty) (Here you can see why I'm proposing In this formulation, there is are Working in the |
After spending time working with
frpnow
, having an instance ofMonad
forBehavior
opens up a lot of new doors, to the point where it's hard to work without it. With bothfrpnow
andreflex
having support for this, I'm hoping that we can find a solution inreactive-banana
, too.The text was updated successfully, but these errors were encountered: