scoped-codensity-0.1.0.0: CPS resource allocation but as a Monad and completely safe
Safe HaskellSafe-Inferred
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 :: MonadUnliftIO m => FilePath -> IOMode -> Scoped s 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.IO.IOMode

Ix IOMode

Since: base-4.2.0.0

Instance details

Defined in GHC.IO.IOMode

Read IOMode

Since: base-4.2.0.0

Instance details

Defined in GHC.IO.IOMode

Show IOMode

Since: base-4.2.0.0

Instance details

Defined in GHC.IO.IOMode

Eq IOMode

Since: base-4.2.0.0

Instance details

Defined in GHC.IO.IOMode

Methods

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

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

Ord IOMode

Since: base-4.2.0.0

Instance details

Defined in GHC.IO.IOMode

hPutStr :: MonadIO m => ScopedHandle s -> Text -> Scoped s m () Source #

Like hPutStr but for ScopedHandle