I'm trying to build a userland interface for localStorage:
-- Send in key port storageGetItem : String -> Cmd msg -- Returns key + Just value if it exists, Nothing if it doesn't. I guess it could also return just the value. port storageGetItemResult : ((String, Maybe String) -> msg) -> Sub msg Even though localStorage has synchronous operations in the browser, that's an implementation detail, I want to be able to design code where the implementation could be async (IndexedDB for example). Is there a way I can turn this into a Task? So I could to update msg model = (model, Task.attempt FooLoaded (getItem "foo")) I guess values received in ports come as subscriptions and from there go into the reducer, but I imagine Tasks are more composable? Like JS Promises? -- You received this message because you are subscribed to the Google Groups "Elm Discuss" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout.
