quipper-libraries-0.9.0.0: The standard libraries for Quipper.

Safe HaskellNone
LanguageHaskell98

Quipper.Libraries.QuipperASCIIParser

Description

This module is the main interface to the QuipperASCIIParser library. It provides functions for parsing circuits in the ASCII format written by print_generic and similar functions.

Synopsis

Documentation

parse_circuit :: String -> ([Endpoint], [Endpoint] -> Circ [Endpoint]) Source #

Parse a string containing a circuit in the format output by Quipper's ASCII format. Return a circuit producing function of the parsed circuit, along with a specimen "shape" for the input of the parsed circuit.

lines' :: String -> [String] Source #

Like lines, except that the last line is omitted if it doesn't end with a newline character

parse_from_stdin :: IO ([Endpoint], [Endpoint] -> Circ [Endpoint]) Source #

Like parse_circuit, but read the circuit from the standard input stream, rather than from a string. This can be used to build stand-alone tools that process circuits in a pipeline.

parse_from_stdin_with_handler :: IO ([Endpoint], [Endpoint] -> Circ [Endpoint]) Source #

Like parse_from_stdin, but as a special convenience, this function also installs a signal handler that will intercept the first kill signal (e.g., Ctrl-C) and close the standard input stream. This means that whichever part of the circuit was generated before the first Ctrl-C can still be processed as a partial circuit. Note that the second kill signal will still kill the program. Note that this is only defined for Non-Windows OS environments.