scoped-codensity-0.1.0.0: CPS resource allocation but as a Monad and completely safe
Safe HaskellNone
LanguageHaskell2010

Control.Monad.Scoped.Handle

Description

Functions and types for safely working with Handles in Scoped blocks

Synopsis

Scoped Handle

type ScopedHandle s = ScopedResource s Handle Source #

Just like Handle but bound to a Scoped block

Allocating a new ScopedHandle in a Scoped block

file :: forall (m :: Type -> Type) s (ss :: [Type]). MonadUnliftIO m => FilePath -> IOMode -> Scoped (s ': ss) m (ScopedHandle s) Source #

Given a FilePath, safely allocates and deallocates a ScopedHandle in a Scoped block

Working with ScopedHandle

data IOMode #

Instances

Instances details
Enum IOMode

@since base-4.2.0.0

Instance details

Defined in GHC.Internal.IO.IOMode

Ix IOMode

@since base-4.2.0.0

Instance details

Defined in GHC.Internal.IO.IOMode

Read IOMode

@since base-4.2.0.0

Instance details

Defined in GHC.Internal.IO.IOMode

Show IOMode

@since base-4.2.0.0

Instance details

Defined in GHC.Internal.IO.IOMode

Eq IOMode

@since base-4.2.0.0

Instance details

Defined in GHC.Internal.IO.IOMode

Methods

(==) :: IOMode -> IOMode -> Bool #

(/=) :: IOMode -> IOMode -> Bool #

Ord IOMode

@since base-4.2.0.0

Instance details

Defined in GHC.Internal.IO.IOMode

hPutStrLn :: forall (m :: Type -> Type) s (ss :: [Type]). (MonadIO m, s :< ss) => ScopedHandle s -> Text -> Scoped ss m () Source #

Like hPutStrLn but for ScopedHandle

hPutStr :: forall (m :: Type -> Type) s (ss :: [Type]). (MonadIO m, s :< ss) => ScopedHandle s -> Text -> Scoped ss m () Source #

Like hPutStr but for ScopedHandle

hGetLine :: forall (m :: Type -> Type) s (ss :: [Type]). (MonadIO m, s :< ss) => ScopedHandle s -> Scoped ss m Text Source #

Like hGetLine but for ScopedHandle

hGetContents :: forall (m :: Type -> Type) s (ss :: [Type]). (MonadIO m, s :< ss) => ScopedHandle s -> Scoped ss m Text Source #