I have a f function with signature f :: [a] -> StateT Int Reader b [c], and f' with signature f' :: a -> StateT Int Reader b [c]
The computation in f (very simplified) looks like that:
f [] = return []
f (s:st) = f' s >>= \x ->
f st >>= \y ->
return $ ...
And in place of the ... I would like to return the [c] part of x ++ the [c] part of y with the monad stuff wrapped around.
Is there a possibility to achieve that without manually unwrapping x and y and manually put the result together again? Do I need a List monad at the bottom of my monad stack to get simple code? The Reader Monad is obviously not an instance of the MonadPlus class.