Skip to content
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

How to do server-side state with the current version? (liftServerIO is gone) #387

Open
WolframKahl opened this issue Sep 6, 2016 · 3 comments

Comments

@WolframKahl
Copy link

I find examples for using server-side state in the Haskell ’14 paper and in haste-compiler/examples/chatbox/chatbox.hs, but these rely on liftServerIO, which is not part of the new Haste anymore.

How can server-sider state be implemented with the new remote $ static (import_ f) pattern?

@WolframKahl
Copy link
Author

For the time being, I got it to work using unsafePerformIO $ ... newIORef ..., but this is not very satisfying...

@valderman
Copy link
Owner

For 0.6, it's still unclear how this will be implemented, since it will support multiple servers among other things. Currently I'm leaning towards putting this into the same class instance as the routing information, bit this isn't set in stone so suggestions are very welcome.

Haste.App.Simple will probably implement something very similar to liftServerIO for the Server special case, since Simple already provides a Node instance for Server.

@valderman
Copy link
Owner

In the new Haste.App, server-side state is implemented using the init method of the Node type class, which is executed on node startup. Its return value is used as the environment of the node. Please see the paper for more details.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants