records- A flexible record system




Record combinators built on top of the record core that Data.Record provides.



type family Cat rec1 rec2 :: * -> *Source

Catenation of two record schemes.

cat :: (TypeFun style, Record (Domain style) rec1, Record (Domain style) rec2) => rec1 style -> rec2 style -> Cat rec1 rec2 styleSource

Catenation of two records.

Applicative functor operations

repeat :: (TypeFun style, Record (Domain style) rec) => Universal style -> rec styleSource

Generates a record whose fields all contain the same value. In contrast to the repeat function from the Prelude, this function generates a finite data structure. Thereby, the size of the generated record is determined by its type. repeat is almost a proper implementation of pure from the Applicative class. The only problem is that the argument of repeat uses the Universal type.

(<<*>>) :: (TypeFun style, TypeFun style', Domain style ~ Domain style', Record (Domain (style -> style')) rec) => rec (style -> style') -> rec style -> rec style'Source

Merges a record of functions and a record of arguments by applying the functions to the corresponding arguments. The (<<*>>) function would be a proper implementation of (<*>) from the Applicative class.

map :: (TypeFun style, TypeFun style', Domain style ~ Domain style', Record (Domain (style -> style')) rec) => Universal (style -> style') -> rec style -> rec style'Source

Transforms a record by applying a function to all its field values.

zipWith :: (TypeFun style1, TypeFun style2, TypeFun style', Domain style1 ~ Domain style2, Domain style2 ~ Domain style', Record (Domain (style1 -> style2 -> style')) rec) => Universal (style1 -> style2 -> style') -> rec style1 -> rec style2 -> rec style'Source

Merges two records by applying a function to each pair of corresponding field values.


modify :: (TypeFun style, Record (Domain style) rec, Record (Domain style) modRec, Convertible rec modRec) => modRec (style -> style) -> rec style -> rec styleSource

Modifies a record by changing some of its field values. The first argument of modify is called the modification record, and the second argument is called the data record. The result is formed by applying each field value of the modification record to the corresponding field value of the data record and replacing the latter by the result of the application. Data record fields that have no corresponding field in the modification record are left unchanged.


toList :: (Kind kind, Record kind rec) => rec (Const kind val) -> [val]Source

Converts a record whose style is a constant function into the list of its field values.