Distribution.Utils.IOData

Cabal-2.2.0.1: A framework for packaging Haskell software

Safe Haskell | None
Language | Haskell2010

Distribution.Utils.IOData

Contents

- `IOData` & `IODataMode` type

Description

Since: Cabal-2.2.0

Synopsis

- data IOData
  - = IODataText String
  - | IODataBinary ByteString
- data IODataMode
  - = IODataModeText
  - | IODataModeBinary
- null :: IOData -> Bool
- hGetContents :: Handle -> IODataMode -> IO IOData
- hPutContents :: Handle -> IOData -> IO ()

# `IOData` & `IODataMode` type

data IOData #

Represents either textual or binary data passed via I/O functions which support binary/text mode

Since: Cabal-2.2.0

Constructors

IODataText String | How Text gets encoded is usually locale-dependent.
IODataBinary ByteString | Raw binary which gets read/written in binary mode.

Instances

NFData IOData # |
Instance details Defined in Distribution.Utils.IOData Methods rnf :: IOData -> () Source #

data IODataMode #

Constructors

IODataModeText |
IODataModeBinary |

null :: IOData -> Bool #

Test whether `IOData` is empty

Since: Cabal-2.2.0

hGetContents :: Handle -> IODataMode -> IO IOData #

`IOData` Wrapper for `hGetContents`

Note: This operation uses lazy I/O. Use `NFData` to force all data to be read and consequently the internal file handle to be closed.

Since: Cabal-2.2.0

hPutContents :: Handle -> IOData -> IO () #

`IOData` Wrapper for `hPutStr` and `hClose`

This is the dual operation ot `ioDataHGetContents`, and consequently the handle is closed with `hClose`.

Since: Cabal-2.2.0