lean-bindings-0.1: Haskell bindings to the Lean Theorem Prover.

Copyright(c) Galois Inc, 2015
LicenseApache-2
Maintainerjhendrix@galois.com, lcasburn@galois.com
Safe HaskellSafe
LanguageHaskell98

Language.Lean.Internal.IOS

Description

Internal declarations for IOState.

Synopsis

Documentation

data IOState tp Source

The IO State object

Lean uses two channels for sending output to the user:

  • A regular output channel, which consists of messages normally printed to stdout.
  • A diagnostic output channel, which consists of debugging messages that are normally printed to stderr.

This module currently provides two different IOState types:

  • A standard IO state that sends regular output to stdout and diagnostic output to stderr.
  • A buffered IO state type that stores output internally, and provides methods for getting output as strings.

To prevent users from accidentally using the wrong type of output, the IOState has an extra type-level parameter used to indicate the type of channel. Most Lean operations support both types of channels and either can be used. Operations specific to a particular channel can use this type parameter to ensure users do not call the function on the wrong type of channel. In addition, we provide a function stateTypeRepr to allow users to determine the type of channel.

withIOState :: IOState tp -> (Ptr SomeIOState -> IO a) -> IO a Source

Run a computation with an io state.

someIOS :: IOState tp -> SomeIOState Source

Lift an arbitray IOState to SomeIOState

data IOStateType Source

This describes the type of the IOState.

Constructors

Standard

A standard IOState

Buffered

A buffered IOState

data SomeIOState Source

Internal state used for bindings

type SomeIOStatePtr = Ptr SomeIOState Source

Haskell type for lean_ios FFI parameters.

type OutSomeIOStatePtr = Ptr SomeIOStatePtr Source

Haskell type for lean_ios* FFI parameters.

withSomeIOState :: SomeIOState -> (Ptr SomeIOState -> IO a) -> IO a Source

Function c2hs uses to pass SomeIOState values to Lean

type BufferedIOState = IOState Buffered Source

Type synonym for c2hs to use specifically for functions that expected buffered IO state.

withBufferedIOState :: IOState Buffered -> (Ptr SomeIOState -> IO a) -> IO a Source

Function c2hs uses to pass BufferedIOState values to Lean