limp-0.3.2.2: representation of Integer Linear Programs

Safe HaskellNone
LanguageHaskell2010

Numeric.Limp.Program.ResultKind

Description

Type-level functions on result types.

Linear functions are classified as either int-valued or real-valued, so we define KZ and KR as data kinds to denote this in the type.

Synopsis

Documentation

data K Source #

Classify the result type of a linear function to either integral or real:

Constructors

KZ

Integral Z

KR

Real or mixed R

data Linear z r c k where Source #

Representation of either integral of real linear functions: a list of variables with coefficients, plus a constant summand.

Constructors

LZ :: [(z, Z c)] -> Z c -> Linear z r c KZ 
LR :: [(Either z r, R c)] -> R c -> Linear z r c KR 

Instances

(Show z, Show r, Show (Z c), Show (R c)) => Show (Linear z r c k) Source # 

Methods

showsPrec :: Int -> Linear z r c k -> ShowS #

show :: Linear z r c k -> String #

showList :: [Linear z r c k] -> ShowS #

type family KMerge (a :: K) (b :: K) :: K where ... Source #

Find the result type of merging, or adding, two linear functions: adding two integers produces an integer, while adding a real on either side produces a real.

Equations

KMerge KZ KZ = KZ 
KMerge KR b = KR 
KMerge a KR = KR 

type family KRep (a :: K) :: * -> * where ... Source #

Convert a K to its actual representation (Z or R).

Equations

KRep KZ = Z 
KRep KR = R