This is a generalization of the async/await syntax, switching out async
for @___
and await
for do
. I don't think we should consider this for 0.15, but it shows where we might want to take things longer term. In this world, a task example looks like this:
@task
[ do print 3
, do print 4
, do print 5
]
A maybe example looks like this:
add : Maybe Int -> Maybe Int -> Maybe Int
add mx my =
@maybe
do mx + do my
It is kind of interesting because we can give it a meaning when we add @task
to a module declaration:
@task module Main where
mb = do mailbox
...
This is cool because Haxl type stuff fits in really easily.
@haxl
[ do get user "http://example.com/alice"
, do get user "http://example.com/bob"
, do get user "http://example.com/candice"
]
And things would all go in parallel.