ersatz-0.4.7: 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
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 :: MonadPlus f => Solution -> a -> f (Decoded a) Source #

Return a value based on the solution if one can be determined.

encode :: Decoded a -> a Source #

Instances
Codec () Source # 
Instance details

Defined in Ersatz.Codec

Associated Types

type Decoded () :: Type Source #

Methods

decode :: MonadPlus f => Solution -> () -> f (Decoded ()) Source #

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

Codec Literal Source # 
Instance details

Defined in Ersatz.Codec

Associated Types

type Decoded Literal :: Type Source #

Codec Bit Source # 
Instance details

Defined in Ersatz.Bit

Associated Types

type Decoded Bit :: Type Source #

Codec Bits Source # 
Instance details

Defined in Ersatz.Bits

Associated Types

type Decoded Bits :: Type Source #

Codec Bit8 Source # 
Instance details

Defined in Ersatz.Bits

Associated Types

type Decoded Bit8 :: Type Source #

Codec Bit7 Source # 
Instance details

Defined in Ersatz.Bits

Associated Types

type Decoded Bit7 :: Type Source #

Codec Bit6 Source # 
Instance details

Defined in Ersatz.Bits

Associated Types

type Decoded Bit6 :: Type Source #

Codec Bit5 Source # 
Instance details

Defined in Ersatz.Bits

Associated Types

type Decoded Bit5 :: Type Source #

Codec Bit4 Source # 
Instance details

Defined in Ersatz.Bits

Associated Types

type Decoded Bit4 :: Type Source #

Codec Bit3 Source # 
Instance details

Defined in Ersatz.Bits

Associated Types

type Decoded Bit3 :: Type Source #

Codec Bit2 Source # 
Instance details

Defined in Ersatz.Bits

Associated Types

type Decoded Bit2 :: Type Source #

Codec Bit1 Source # 
Instance details

Defined in Ersatz.Bits

Associated Types

type Decoded Bit1 :: Type Source #

Codec BitChar Source # 
Instance details

Defined in Ersatz.BitChar

Associated Types

type Decoded BitChar :: Type Source #

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

Defined in Ersatz.Codec

Associated Types

type Decoded [a] :: Type Source #

Methods

decode :: MonadPlus f => Solution -> [a] -> f (Decoded [a]) Source #

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

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

Defined in Ersatz.Codec

Associated Types

type Decoded (Maybe a) :: Type Source #

Methods

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

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

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

Defined in Ersatz.Codec

Associated Types

type Decoded (IntMap a) :: Type Source #

Methods

decode :: MonadPlus f => Solution -> IntMap a -> f (Decoded (IntMap a)) Source #

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

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

Defined in Ersatz.Codec

Associated Types

type Decoded (Tree a) :: Type Source #

Methods

decode :: MonadPlus f => Solution -> Tree a -> f (Decoded (Tree a)) Source #

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

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

Defined in Ersatz.Codec

Associated Types

type Decoded (Seq a) :: Type Source #

Methods

decode :: MonadPlus f => Solution -> Seq a -> f (Decoded (Seq a)) Source #

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

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

Defined in Ersatz.Codec

Associated Types

type Decoded (Either a b) :: Type Source #

Methods

decode :: MonadPlus f => Solution -> Either a b -> f (Decoded (Either a b)) Source #

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

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

Defined in Ersatz.Codec

Associated Types

type Decoded (a, b) :: Type Source #

Methods

decode :: MonadPlus f => Solution -> (a, b) -> f (Decoded (a, b)) Source #

encode :: Decoded (a, b) -> (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) :: Type Source #

Methods

decode :: MonadPlus f => Solution -> Array i e -> f (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) :: Type Source #

Methods

decode :: MonadPlus f => Solution -> Map k a -> f (Decoded (Map k a)) Source #

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

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

Defined in Ersatz.Codec

Associated Types

type Decoded (HashMap k a) :: Type Source #

Methods

decode :: MonadPlus f => Solution -> HashMap k a -> f (Decoded (HashMap k a)) Source #

encode :: Decoded (HashMap k a) -> HashMap 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) :: Type Source #

Methods

decode :: MonadPlus f => Solution -> Relation a b -> f (Decoded (Relation a b)) Source #

encode :: Decoded (Relation a b) -> Relation 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) :: Type Source #

Methods

decode :: MonadPlus f => Solution -> (a, b, c) -> f (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) :: Type Source #

Methods

decode :: MonadPlus f => Solution -> (a, b, c, d) -> f (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) :: Type Source #

Methods

decode :: MonadPlus f => Solution -> (a, b, c, d, e) -> f (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) :: Type Source #

Methods

decode :: MonadPlus f0 => Solution -> (a, b, c, d, e, f) -> f0 (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) :: Type Source #

Methods

decode :: MonadPlus f0 => Solution -> (a, b, c, d, e, f, g) -> f0 (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) :: Type Source #

Methods

decode :: MonadPlus f0 => Solution -> (a, b, c, d, e, f, g, h) -> f0 (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 #