Last active
April 29, 2022 20:43
-
-
Save chris-martin/4992506d9f4900f706b43de5e2d4f183 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{-# language NoImplicitPrelude, ScopedTypeVariables, TypeApplications #-} | |
import Relude | |
import Control.Monad.Trans.Resource | |
import List.Transformer | |
class Run f where | |
run :: f a -> IO () | |
instance Run IO where | |
run action = do | |
_ <- action | |
return () | |
instance (Run m, MonadUnliftIO m) => Run (ResourceT m) where | |
run action = run @m (runResourceT @m action) | |
instance (Run m, Monad m) => Run (ListT m) where | |
run action = run @m (runListT @m action) | |
instance (Run m, Monad m) => Run (MaybeT m) where | |
run action = run @m do | |
_ <- runMaybeT @m action | |
return () |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment