Stream: beginners

Topic: In memory data store, AKA state monad?


view this post on Zulip Agustin Romero (Nov 04 2024 at 18:37):

Hi! i'm starting to play around with Roc and was trying to build a todo web server in the basic-webserver platform.
I did not want to mess with sqlite or anything a simple dict holding my TODOs would be enough.

Is there a way to do this in roc? i suspect the platform should give me some way to create mutable state which is done through a state monad in most purely functional programmig languages.

How would one do this in Roc?

view this post on Zulip Anton (Nov 04 2024 at 18:48):

Hi @Agustin Romero,

Is there a way to do this in roc?

This is possible but I recommend going with the sqlite version for now, modifying the platform will likely be more complicated if you've never done that before.

view this post on Zulip Agustin Romero (Nov 04 2024 at 18:50):

Hi Anton thanks for the quick reply,
so i was correct there is literally no way to do that right now

view this post on Zulip Luke Boswell (Nov 04 2024 at 19:11):

Correct. Each http request is basically completely isolated from other requests and run on different threads.

view this post on Zulip Agustin Romero (Nov 04 2024 at 22:14):

hey luke feeling quite dumb here... copied the sqlite example from the platform and replaced the platform import...
Getting a file not found error. Any clues?

view this post on Zulip Agustin Romero (Nov 04 2024 at 22:25):

sorry... looking at the future docs :P


Last updated: Jul 06 2025 at 12:14 UTC