| 1 |
------------------------------------------------------------------------ |
| 2 |
-- The Agda standard library |
| 3 |
-- |
| 4 |
-- IO handles: simple bindings to Haskell types and functions |
| 5 |
------------------------------------------------------------------------ |
| 6 |
|
| 7 |
{-# OPTIONS --cubical-compatible --guardedness #-} |
| 8 |
|
| 9 |
module IO.Handle where |
| 10 |
|
| 11 |
open import Level using (Level) |
| 12 |
open import Data.Unit.Polymorphic.Base using (⊤) |
| 13 |
open import IO.Base using (IO; lift; lift′) |
| 14 |
|
| 15 |
private variable a : Level |
| 16 |
|
| 17 |
------------------------------------------------------------------------ |
| 18 |
-- Re-exporting types and constructors |
| 19 |
|
| 20 |
open import IO.Primitive.Handle as Prim public |
| 21 |
using ( BufferMode |
| 22 |
; noBuffering |
| 23 |
; lineBuffering |
| 24 |
; blockBuffering |
| 25 |
; Handle |
| 26 |
; stdin |
| 27 |
; stdout |
| 28 |
; stderr |
| 29 |
) |
| 30 |
|
| 31 |
------------------------------------------------------------------------ |
| 32 |
-- Wrapping functions |
| 33 |
|
| 34 |
hSetBuffering : Handle → BufferMode → IO {a} ⊤ |
| 35 |
hSetBuffering hdl bm = lift′ (Prim.hSetBuffering hdl bm) |
| 36 |
|
| 37 |
hGetBuffering : Handle → IO BufferMode |
| 38 |
hGetBuffering hdl = lift (Prim.hGetBuffering hdl) |
| 39 |
|
| 40 |
hFlush : Handle → IO {a} ⊤ |
| 41 |
hFlush hdl = lift′ (Prim.hFlush hdl) |