How do you extract value from Shell monad?
I would like to streamline the list of ร la bash commands &&, but I would also like to extract the final value ExitCode.
Let's say I have the following code:
import Turtle
type Commands = [Shell ExitCode]
run :: (MonadIO io) => Commands -> io ExitCode
run cs = whatIsThisFunction $ Prelude.foldl (.&&.) (return ExitSuccess) cs
whatIsThisFunction :: (MonadIO io) => Shell a -> io a
whatIsThisFunction = undefined
I tried to figure out if I could implement this using Control.Foldl, but could not find a solution.
Any ideas?
More generally, why Turtle does not provide a function with such a signature:
sh' :: MonadIO io => Shell a -> io a
source
share