ersatz-0.6: 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 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 
Instance details

Defined in Ersatz.Bit

Codec BitChar Source # 
Instance details

Defined in Ersatz.BitChar

Associated Types

type Decoded BitChar 
Instance details

Defined in Ersatz.BitChar

Codec Bit1 Source # 
Instance details

Defined in Ersatz.Bits

Associated Types

type Decoded Bit1 
Instance details

Defined in Ersatz.Bits

Codec Bit2 Source # 
Instance details

Defined in Ersatz.Bits

Associated Types

type Decoded Bit2 
Instance details

Defined in Ersatz.Bits

Codec Bit3 Source # 
Instance details

Defined in Ersatz.Bits

Associated Types

type Decoded Bit3 
Instance details

Defined in Ersatz.Bits

Codec Bit4 Source # 
Instance details

Defined in Ersatz.Bits

Associated Types

type Decoded Bit4 
Instance details

Defined in Ersatz.Bits

Codec Bit5 Source # 
Instance details

Defined in Ersatz.Bits

Associated Types

type Decoded Bit5 
Instance details

Defined in Ersatz.Bits

Codec Bit6 Source # 
Instance details

Defined in Ersatz.Bits

Associated Types

type Decoded Bit6 
Instance details

Defined in Ersatz.Bits

Codec Bit7 Source # 
Instance details

Defined in Ersatz.Bits

Associated Types

type Decoded Bit7 
Instance details

Defined in Ersatz.Bits

Codec Bit8 Source # 
Instance details

Defined in Ersatz.Bits

Associated Types

type Decoded Bit8 
Instance details

Defined in Ersatz.Bits

Codec Bits Source # 
Instance details

Defined in Ersatz.Bits

Associated Types

type Decoded Bits 
Instance details

Defined in Ersatz.Bits

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 
Instance details

Defined in Ersatz.Codec

Codec () Source # 
Instance details

Defined in Ersatz.Codec

Associated Types

type Decoded () 
Instance details

Defined in Ersatz.Codec

type Decoded () = ()

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) 
Instance details

Defined in Ersatz.Codec

type Decoded (IntMap a) = IntMap (Decoded a)
Codec a => Codec (Seq a) Source # 
Instance details

Defined in Ersatz.Codec

Associated Types

type Decoded (Seq a) 
Instance details

Defined in Ersatz.Codec

type Decoded (Seq a) = Seq (Decoded a)

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) 
Instance details

Defined in Ersatz.Codec

type Decoded (Tree a) = Tree (Decoded a)

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) 
Instance details

Defined in Ersatz.Codec

type Decoded (Maybe a) = Maybe (Decoded a)
Codec a => Codec [a] Source # 
Instance details

Defined in Ersatz.Codec

Associated Types

type Decoded [a] 
Instance details

Defined in Ersatz.Codec

type Decoded [a] = [Decoded a]

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) 
Instance details

Defined in Ersatz.Codec

type Decoded (Either a b) = Either (Decoded a) (Decoded b)

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) 
Instance details

Defined in Ersatz.Codec

type Decoded (Array i e) = Array i (Decoded e)

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) 
Instance details

Defined in Ersatz.Codec

type Decoded (Map k a) = Map k (Decoded a)

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) 
Instance details

Defined in Ersatz.Relation.Data

type Decoded (Relation a b) = Array (a, b) Bool
Codec a => Codec (HashMap k a) Source # 
Instance details

Defined in Ersatz.Codec

Associated Types

type Decoded (HashMap k a) 
Instance details

Defined in Ersatz.Codec

type Decoded (HashMap k a) = HashMap k (Decoded a)

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) 
Instance details

Defined in Ersatz.Codec

type Decoded (a, b) = (Decoded a, Decoded b)

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) 
Instance details

Defined in Ersatz.Codec

type Decoded (a, b, c) = (Decoded a, Decoded b, Decoded c)

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) 
Instance details

Defined in Ersatz.Codec

type Decoded (a, b, c, d) = (Decoded a, Decoded b, Decoded c, Decoded d)

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) 
Instance details

Defined in Ersatz.Codec

type Decoded (a, b, c, d, e) = (Decoded a, Decoded b, Decoded c, Decoded d, Decoded e)

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) 
Instance details

Defined in Ersatz.Codec

type Decoded (a, b, c, d, e, f) = (Decoded a, Decoded b, Decoded c, Decoded d, Decoded e, Decoded f)

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) 
Instance details

Defined in Ersatz.Codec

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

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) 
Instance details

Defined in Ersatz.Codec

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

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 #