Safe Haskell | Safe-Inferred |
---|---|
Language | GHC2021 |
Documentation
The app monad. woo.
class Monad m => MonadApp m where Source #
Lifts computations to the app monad level. (MonadApp m)
shouldn't be used directly as a constraint;
Rather, just use liftApp
and see Has
.
runService :: FeatureError e => AppM (Either e a) -> ActionT AppM a Source #
Runs a service in the App monad and converts its potentially failed result to the appropriate error if neccesary.
data MyErr = Aw Text data MyResult = Yay Text deriving (Generic, ToJSON) instance FeatureError MyErr where handleFeatureError (ResultErr msg) = do status status500 text msg endpoint = get "/" $ do (result :: MyResult) <- runService (someAppService :: AppM (Either MyErr MyResult)) json result