3 ms·
You can translate this directly to Haskell and it works as you would expect. You also have a lot of freedom on how to process the answer. catch (do
by light_hue_1 3y ago
You can translate this directly to Haskell and it works as you would expect. You also have a lot of freedom on how to process the answer.
catch
(do
user_id <- get_user_id <$> request
user <- user_id . get_user <$> db.get_user
authorize user
print $ "Found user " <> user ^. name)
(\e -> print "Error unauthorized)
I don't want to say it.. but both this and Breakelse are rediscovering a basic use case of Monads :)
- FeepingCreature 3y agoSee over here: https://news.ycombinator.com/item?id=37889533 https://news.ycombinator.com/item?id=37889533 I am aware of Monads (they're explicitly called out in the article!), and specifically want to go in a different direction.