joshuaclayton/elm-report-builder/1.0.0

ReportBuilder.Field

ReportBuilder.Field provides a way to define fields that can be used to generate reports.

Definitions

type Field a

A field describes a column in a report. It has a name, an accessor function and a type.

A field accessor is a function that takes a record and returns a string.

Constructor

new : String -> FieldAccess a -> Field a

Create a new field with a name and an accessor function.

Field Types

{ true : String
, false : String
}
-> (a -> Bool)

Define field access for a boolean.

int : (a -> Int) -> FieldAccess a

Define field access for an integer.

string : (a -> String) -> FieldAccess a

Define field access for a string.

Field Modifiers

optional : ((a -> b) -> FieldAccess a) -> (a -> Maybe b) -> FieldAccess a

Mark a field as optional.

Computed FieldAccess

lengthOf : (a -> List b) -> FieldAccess a

Define field access for the length of a list.

Generate values

encode : a -> Field a -> String

Given a field and a corresponding record, return the value of the field.

Annotate numeric values

isNumeric : Field a -> Bool

Check if a field is numeric.

Mark a field as numeric.