module CabalGild.Class.MonadRead where import qualified Data.ByteString as ByteString -- | A 'Monad' that can also read input, either from standard input (STDIN) or -- from a file. class (Monad m) => MonadRead m where -- | Reads input from the given file, or from STDIN if the given file is -- 'Nothing'. read :: Maybe FilePath -> m ByteString.ByteString -- | Uses 'ByteString.getContents' or 'ByteString.readFile'. instance MonadRead IO where read :: Maybe FilePath -> IO ByteString read = IO ByteString -> (FilePath -> IO ByteString) -> Maybe FilePath -> IO ByteString forall b a. b -> (a -> b) -> Maybe a -> b maybe IO ByteString ByteString.getContents FilePath -> IO ByteString ByteString.readFile