| Safe Haskell | Safe |
|---|---|
| Language | Haskell2010 |
System.IO.StringLike.GetContents
- class CanGetContentsClass IO Handle t => CanGetContents t
- class Monad m => CanGetContentsClass m handleT t where
- getContents :: CanGetContents t => IO t
- readFile :: CanGetContents t => FilePath -> IO t
- interact :: (CanGetContents t, CanPutStr t) => (t -> t) -> IO ()
Documentation
class CanGetContentsClass IO Handle t => CanGetContents t Source #
CanGetContents if effectively the following type synonym, for the common case of
an ordinary Handle in the IO monad like so.
type CanGetContents t = CanGetContentsClass IO Handle t
The reason why it's defined as a class with a catch all instance instead is so
modules which use CanGetContents do not have to include the language pragma FleixbleContexts.
However, this approach requires this module to use the pragma UndecidableInstances, but I figure it's better to add more complexity to the library than to clients.
CanGet, CanGetLine, CanPutStr, CanPutStrLn all are similar synonyms with
the same explanation for their definition so I won't repeat myself.
Instances
| CanGetContentsClass IO Handle t => CanGetContents t Source # | |
class Monad m => CanGetContentsClass m handleT t where Source #
Methods
hGetContents :: handleT -> m t Source #
Generalised hGetContents
hGetContents :: (CanProxyFrom t, CanGetContentsClass m handleT (CanProxyT t)) => handleT -> m t Source #
Generalised hGetContents
Instances
| (Monad m, CanGetContentsClass m Handle Text) => CanGetContentsClass m Handle Builder Source # | |
| (~) (* -> *) m IO => CanGetContentsClass m Handle Text Source # | |
| (~) (* -> *) m IO => CanGetContentsClass m Handle Text Source # | |
| (Monad m, CanGetContentsClass m Handle ByteString) => CanGetContentsClass m Handle Builder Source # | |
| (~) (* -> *) m IO => CanGetContentsClass m Handle ByteString Source # | |
| (~) (* -> *) m IO => CanGetContentsClass m Handle ByteString Source # | |
| (~) (* -> *) m IO => CanGetContentsClass m Handle String Source # | |
| ((~) (* -> *) m IO, CanGetContentsClass m Handle t) => CanGetContentsClass m FilePath t Source # | |
getContents :: CanGetContents t => IO t Source #