dynamic-object-0.2.1: Object-oriented programming with duck typing and singleton classes.

Safe HaskellNone

Data.Object.Dynamic.Type

Synopsis

Documentation

newtype Object u Source

The Object type, where u carrying the information of its underlying types.

Constructors

Object 

Fields

unObject :: Table
 

newtype Table Source

The Table within an Object that carries all the member data.

Constructors

Table 

Fields

unTable :: TableMap
 

type TableMap = Map TypeRep DynamicSource

The Map type within the table.

class Objective o whereSource

o is an Objective if given its type information, there is an equivalence between o and the Table.

Instances

class (Objective o, Typeable memb, Typeable (ValType o memb)) => Member o memb whereSource

This means that memb is one of the member labels of o. The ValType of the member depends both on the label and (the underlying types of) the object.

Associated Types

type ValType o memb :: *Source

Methods

memberLens :: memb -> MemberLens o membSource

memberLookup :: memb -> Acyclic o (ValType o memb)Source

type MemberLens o memb = Member o memb => Simple Traversal o (ValType o memb)Source

The lens for accessing the Member of the Object.

mkMemberLensSource

Arguments

:: Member o memb 
=> memb

member label

-> MemberLens o memb

generated lens

A utility function for defining a MemberLens .

mkMemberLookupDefSource

Arguments

:: Member o memb 
=> memb

member label

-> Acyclic o (ValType o memb)

default accessor when the record is missing

-> Acyclic o (ValType o memb)

member accessor

A utility function for defining a MemberLookup, with a default computation for the case the member is missing.

mkMemberLookupSource

Arguments

:: Member o memb 
=> memb

member label

-> Acyclic o (ValType o memb)

member accessor

Defining a MemberLookup, without default.

insert :: (Objective o, Member o memb, ValType o memb ~ val, Typeable memb, Typeable val) => memb -> val -> o -> oSource

Given a pair of Member label and a value, create the data field for the member and inserts the value.

type Acyclic o a = RWST o () (Set TypeRep) Maybe aSource

Acyclic monad is used to lookup a member of the object with infinite-loop detection.

its :: Member o memb => memb -> Acyclic o (ValType o memb)Source

acyclicallySource

Arguments

:: Member o memb 
=> Acyclic o (ValType o memb)

default accessor when the record is missing

-> memb

member label

-> Acyclic o (ValType o memb)

member accessor