Skip to content

Instantly share code, notes, and snippets.

@chris-martin
Last active April 29, 2022 20:43
Show Gist options
  • Save chris-martin/4992506d9f4900f706b43de5e2d4f183 to your computer and use it in GitHub Desktop.
Save chris-martin/4992506d9f4900f706b43de5e2d4f183 to your computer and use it in GitHub Desktop.
{-# 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