io-string-like-0.1.0.0: Classes to handle Prelude style IO functions for different datatypes

Safe HaskellSafe
LanguageHaskell2010

System.IO.StringLike.GetContents

Synopsis

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.

interact :: (CanGetContents t, CanPutStr t) => (t -> t) -> IO () Source #