ersatz-0.5: A monad for expressing SAT or QSAT problems using observable sharing.
Copyright© Edward Kmett 2010-2014 Johan Kiviniemi 2013
LicenseBSD3
MaintainerEdward Kmett <ekmett@gmail.com>
Stabilityexperimental
Portabilitynon-portable
Safe HaskellSafe-Inferred
LanguageHaskell2010

Ersatz.Codec

Description

 
Synopsis

Documentation

class Codec a where Source #

This class describes data types that can be marshaled to or from a SAT solver.

Associated Types

type Decoded a :: Type Source #

Methods

decode :: Solution -> a -> Maybe (Decoded a) Source #

Return Just a value based on the solution if one can be determined. Otherwise, return Nothing.

encode :: Decoded a -> a Source #

Instances

Instances details
Codec Bit Source # 
Instance details

Defined in Ersatz.Bit

Associated Types

type Decoded Bit Source #

Codec BitChar Source # 
Instance details

Defined in Ersatz.BitChar

Associated Types

type Decoded BitChar Source #

Codec Bit1 Source # 
Instance details

Defined in Ersatz.Bits

Associated Types

type Decoded Bit1 Source #

Codec Bit2 Source # 
Instance details

Defined in Ersatz.Bits

Associated Types

type Decoded Bit2 Source #

Codec Bit3 Source # 
Instance details

Defined in Ersatz.Bits

Associated Types

type Decoded Bit3 Source #

Codec Bit4 Source # 
Instance details

Defined in Ersatz.Bits

Associated Types

type Decoded Bit4 Source #

Codec Bit5 Source # 
Instance details

Defined in Ersatz.Bits

Associated Types

type Decoded Bit5 Source #

Codec Bit6 Source # 
Instance details

Defined in Ersatz.Bits

Associated Types

type Decoded Bit6 Source #

Codec Bit7 Source # 
Instance details

Defined in Ersatz.Bits

Associated Types

type Decoded Bit7 Source #

Codec Bit8 Source # 
Instance details

Defined in Ersatz.Bits

Associated Types

type Decoded Bit8 Source #

Codec Bits Source # 
Instance details

Defined in Ersatz.Bits

Associated Types

type Decoded Bits Source #

Codec Literal Source #

By convention, the decode implementation will return False for unconstrained non-negative Literals and True for unconstrained negative Literals.

Instance details

Defined in Ersatz.Codec

Associated Types

type Decoded Literal Source #

Codec () Source # 
Instance details

Defined in Ersatz.Codec

Associated Types

type Decoded () Source #

Methods

decode :: Solution -> () -> Maybe (Decoded ()) Source #

encode :: Decoded () -> () Source #

Codec a => Codec (IntMap a) Source # 
Instance details

Defined in Ersatz.Codec

Associated Types

type Decoded (IntMap a) Source #

Codec a => Codec (Seq a) Source # 
Instance details

Defined in Ersatz.Codec

Associated Types

type Decoded (Seq a) Source #

Methods

decode :: Solution -> Seq a -> Maybe (Decoded (Seq a)) Source #

encode :: Decoded (Seq a) -> Seq a Source #

Codec a => Codec (Tree a) Source # 
Instance details

Defined in Ersatz.Codec

Associated Types

type Decoded (Tree a) Source #

Methods

decode :: Solution -> Tree a -> Maybe (Decoded (Tree a)) Source #

encode :: Decoded (Tree a) -> Tree a Source #

Codec a => Codec (Maybe a) Source # 
Instance details

Defined in Ersatz.Codec

Associated Types

type Decoded (Maybe a) Source #

Codec a => Codec [a] Source # 
Instance details

Defined in Ersatz.Codec

Associated Types

type Decoded [a] Source #

Methods

decode :: Solution -> [a] -> Maybe (Decoded [a]) Source #

encode :: Decoded [a] -> [a] Source #

(Codec a, Codec b) => Codec (Either a b) Source # 
Instance details

Defined in Ersatz.Codec

Associated Types

type Decoded (Either a b) Source #

Methods

decode :: Solution -> Either a b -> Maybe (Decoded (Either a b)) Source #

encode :: Decoded (Either a b) -> Either a b Source #

(Ix i, Codec e) => Codec (Array i e) Source # 
Instance details

Defined in Ersatz.Codec

Associated Types

type Decoded (Array i e) Source #

Methods

decode :: Solution -> Array i e -> Maybe (Decoded (Array i e)) Source #

encode :: Decoded (Array i e) -> Array i e Source #

Codec a => Codec (Map k a) Source # 
Instance details

Defined in Ersatz.Codec

Associated Types

type Decoded (Map k a) Source #

Methods

decode :: Solution -> Map k a -> Maybe (Decoded (Map k a)) Source #

encode :: Decoded (Map k a) -> Map k a Source #

(Ix a, Ix b) => Codec (Relation a b) Source # 
Instance details

Defined in Ersatz.Relation.Data

Associated Types

type Decoded (Relation a b) Source #

Codec a => Codec (HashMap k a) Source # 
Instance details

Defined in Ersatz.Codec

Associated Types

type Decoded (HashMap k a) Source #

Methods

decode :: Solution -> HashMap k a -> Maybe (Decoded (HashMap k a)) Source #

encode :: Decoded (HashMap k a) -> HashMap k a Source #

(Codec a, Codec b) => Codec (a, b) Source # 
Instance details

Defined in Ersatz.Codec

Associated Types

type Decoded (a, b) Source #

Methods

decode :: Solution -> (a, b) -> Maybe (Decoded (a, b)) Source #

encode :: Decoded (a, b) -> (a, b) Source #

(Codec a, Codec b, Codec c) => Codec (a, b, c) Source # 
Instance details

Defined in Ersatz.Codec

Associated Types

type Decoded (a, b, c) Source #

Methods

decode :: Solution -> (a, b, c) -> Maybe (Decoded (a, b, c)) Source #

encode :: Decoded (a, b, c) -> (a, b, c) Source #

(Codec a, Codec b, Codec c, Codec d) => Codec (a, b, c, d) Source # 
Instance details

Defined in Ersatz.Codec

Associated Types

type Decoded (a, b, c, d) Source #

Methods

decode :: Solution -> (a, b, c, d) -> Maybe (Decoded (a, b, c, d)) Source #

encode :: Decoded (a, b, c, d) -> (a, b, c, d) Source #

(Codec a, Codec b, Codec c, Codec d, Codec e) => Codec (a, b, c, d, e) Source # 
Instance details

Defined in Ersatz.Codec

Associated Types

type Decoded (a, b, c, d, e) Source #

Methods

decode :: Solution -> (a, b, c, d, e) -> Maybe (Decoded (a, b, c, d, e)) Source #

encode :: Decoded (a, b, c, d, e) -> (a, b, c, d, e) Source #

(Codec a, Codec b, Codec c, Codec d, Codec e, Codec f) => Codec (a, b, c, d, e, f) Source # 
Instance details

Defined in Ersatz.Codec

Associated Types

type Decoded (a, b, c, d, e, f) Source #

Methods

decode :: Solution -> (a, b, c, d, e, f) -> Maybe (Decoded (a, b, c, d, e, f)) Source #

encode :: Decoded (a, b, c, d, e, f) -> (a, b, c, d, e, f) Source #

(Codec a, Codec b, Codec c, Codec d, Codec e, Codec f, Codec g) => Codec (a, b, c, d, e, f, g) Source # 
Instance details

Defined in Ersatz.Codec

Associated Types

type Decoded (a, b, c, d, e, f, g) Source #

Methods

decode :: Solution -> (a, b, c, d, e, f, g) -> Maybe (Decoded (a, b, c, d, e, f, g)) Source #

encode :: Decoded (a, b, c, d, e, f, g) -> (a, b, c, d, e, f, g) Source #

(Codec a, Codec b, Codec c, Codec d, Codec e, Codec f, Codec g, Codec h) => Codec (a, b, c, d, e, f, g, h) Source # 
Instance details

Defined in Ersatz.Codec

Associated Types

type Decoded (a, b, c, d, e, f, g, h) Source #

Methods

decode :: Solution -> (a, b, c, d, e, f, g, h) -> Maybe (Decoded (a, b, c, d, e, f, g, h)) Source #

encode :: Decoded (a, b, c, d, e, f, g, h) -> (a, b, c, d, e, f, g, h) Source #