ghci4luatex-0.0: A GHCi session in LaTeX
Copyright(c) Alice Rixte 2024
LicenseBSD 3
Maintaineralice.rixte@u-bordeaux.fr
Stabilityunstable
Portabilitynon-portable (GHC extensions)
Safe HaskellNone
LanguageHaskell2010

System.Process.Ghci

Description

Run GHCi as a process, and execute commands.

Usage

>>> ghci <- startGhci Quiet "ghci" []
>>> execGhciCmd ghci Quiet "1+2"
GhciResult {ghciErr = "", ghciOut = "3"}
Synopsis

Documentation

data Ghci Source #

A GHCi process

Constructors

Ghci 

Fields

startGhci Source #

Arguments

:: Verbosity

When verbosity >= Normal, the entire output of GHCi is printed

-> String

The command to run (e.g. "ghci", "cabal" or "stack")

-> [String]

The list of the command's arguments (e.g. "repl" for "cabal" or "ghci" for "stack")

-> IO Ghci 

Start a GHCi process.

>>> ghci = startGhci Normal "ghci" []
>>> ghci = startGhci Loud "stack" ["ghci"]

data GhciResult Source #

The result printed by GHCi.

Constructors

GhciResult 

Fields

Instances

Instances details
FromJSON GhciResult Source # 
Instance details

Defined in System.Process.Ghci

ToJSON GhciResult Source # 
Instance details

Defined in System.Process.Ghci

Monoid GhciResult Source # 
Instance details

Defined in System.Process.Ghci

Semigroup GhciResult Source # 
Instance details

Defined in System.Process.Ghci

Generic GhciResult Source # 
Instance details

Defined in System.Process.Ghci

Associated Types

type Rep GhciResult 
Instance details

Defined in System.Process.Ghci

type Rep GhciResult = D1 ('MetaData "GhciResult" "System.Process.Ghci" "ghci4luatex-0.0-Jv5SPIpPTHrKSXMY8q8YbO" 'False) (C1 ('MetaCons "GhciResult" 'PrefixI 'True) (S1 ('MetaSel ('Just "ghciErr") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Text) :*: S1 ('MetaSel ('Just "ghciOut") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Text)))
Show GhciResult Source # 
Instance details

Defined in System.Process.Ghci

type Rep GhciResult Source # 
Instance details

Defined in System.Process.Ghci

type Rep GhciResult = D1 ('MetaData "GhciResult" "System.Process.Ghci" "ghci4luatex-0.0-Jv5SPIpPTHrKSXMY8q8YbO" 'False) (C1 ('MetaCons "GhciResult" 'PrefixI 'True) (S1 ('MetaSel ('Just "ghciErr") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Text) :*: S1 ('MetaSel ('Just "ghciOut") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Text)))

execGhciCmd Source #

Arguments

:: Ghci

A GHCi process

-> Verbosity

When verbosity >= Normal, the entire output of GHCi is printed

-> String

The command to execute

-> IO GhciResult

The result of the execution

Sends a command to ghci and wait for its result.

>>> execGhciCmd ghci Normal "1+2"
GhciResult {ghciErr = "", ghciOut = "3"}