toysolver-0.6.0: Assorted decision procedures for SAT, SMT, Max-SAT, PB, MIP, etc

Copyright(c) Masahiro Sakai 2016-2018
LicenseBSD-style
Maintainermasahiro.sakai@gmail.com
Stabilityprovisional
Portabilitynon-portable
Safe HaskellSafe
LanguageHaskell2010

ToySolver.FileFormat.Base

Contents

Description

 
Synopsis

FileFormat class

class FileFormat a where Source #

A type class that abstracts file formats

Methods

parse :: ByteString -> Either String a Source #

Parse a lazy byte string, and either returns error message or a parsed value

render :: a -> Builder Source #

Encode a value into Builder

data ParseError Source #

ParseError represents a parse error and it wraps a error message.

Constructors

ParseError String 

parseFile :: (FileFormat a, MonadIO m) => FilePath -> m (Either String a) Source #

Parse a file but returns an error message when parsing fails.

readFile :: (FileFormat a, MonadIO m) => FilePath -> m a Source #

Parse a file. Similar to parseFile but this function throws ParseError when parsing fails.

writeFile :: (FileFormat a, MonadIO m) => FilePath -> a -> m () Source #

Write a value into a file.