ganeti
Safe HaskellSafe

Ganeti.PartialParams

Description

Common functions for partial parameters

Synopsis

Documentation

class PartialParams f p | p -> f, f -> p where Source #

Represents that data type p provides partial values for data type f.

Note: To avoid needless type annotations, the functional dependencies currently include f -> p. However, in theory it'd be possible for one filled data type to have several partially filled ones.

Laws:

  1. fillParams (fillParams f p) p = fillParams f p.
  2. fillParams _ (toPartial x) = x.
  3. toFilled (toPartial x) = Just x.

If p is also a Monoid (or just Semigroup), fillParams is a monoid (semigroup) action on f, therefore it should additionally satisfy:

  • fillParams f mempty = f
  • fillParams f (p1 <> p2) = fillParams (fillParams f p1) p2

Methods

fillParams :: f -> p -> f Source #

Fill f with any data that are set in p. Leave other parts of f unchanged.

toPartial :: f -> p Source #

Fill all fields of p from f.

toFilled :: p -> Maybe f Source #

If all fields of p are filled, convert it into f.

Instances

Instances details
PartialParams FilledNicParams PartialNicParams # 
Instance details

Defined in Ganeti.Objects.Nic

PartialParams FilledBeParams PartialBeParams # 
Instance details

Defined in Ganeti.Objects.Instance

PartialParams FilledISpecParams PartialISpecParams # 
Instance details

Defined in Ganeti.Objects

PartialParams FilledIPolicy PartialIPolicy #

Custom filler for the ipolicy types.

Instance details

Defined in Ganeti.Objects

PartialParams FilledNDParams PartialNDParams # 
Instance details

Defined in Ganeti.Objects

isComplete :: PartialParams f p => p -> Bool Source #

Returns True if a given partial parameters are complete. See toFilled.