-
-
Notifications
You must be signed in to change notification settings - Fork 4
Open
Description
Currently if your application model depends on the result of a task that can fail, you need to keep a Maybe on the model, because you have to call Node.startProgram with an instance of your model no matter what. If there was a way to explicitly not start the program, you could avoid the Maybe and fail directly in init. For example:
getSecureContext : Task Never (Maybe Crypto.SecureContext)
getSecureContext =
-- Turn fail-able task into one that always resolves.
...
init env =
Init.await getSecureContext <| \maybeSecureContext ->
when maybeSecureContext is
Nothing ->
Node.failToStart "Failed to get secure context."
Just secureContext ->
Node.startProgram
{ model =
{ secureContext = secureContext -- don't need a Maybe
...Probably will want something similar for Browser.
Metadata
Metadata
Assignees
Labels
No labels