Headline

Data composition in Haskell with algebraic data types

Characteristics

The data model leverages data composition for companies with departmental nesting. Thus, an algebraic data type is used for departments so that recursive nesting can be expressed. The algebraic data type only needs a single data constructor. Thus, data variation is not exercised, but see Contribution:haskellVariation for an alternative with data variation.

Illustration

The data model leverages an algebraic data type for departments; in this manner recursion is enabled:

Fragment not found

A sample company looks like this:

Fragment not found

Feature:Total is implemented as follows:

Fragment not found

The following salary total is computed for the sample company:

399747.0

Relationships

Architecture

There are these modules:

Fragment not found
: a data model for Feature:Hierarchical company
Fragment not found
: a sample company
Fragment not found
: the implementation of Feature:Total
Fragment not found
: the implementation of Feature:Cut
Fragment not found
: Tests

The types of

Fragment not found
implement Feature:Closed serialization through Haskell's read/show.

Usage

See https://github.com/101companies/101haskell/blob/master/README.md.


Kevin edited this article at Fri, 05 May 2017 20:32:40 +0200
Compare revisions Compare revisions

User contributions

    This user never has never made submissions.

    User edits

    Syntax for editing wiki

    For you are available next options:

    will make text bold.

    will make text italic.

    will make text underlined.

    will make text striked.

    will allow you to paste code headline into the page.

    will allow you to link into the page.

    will allow you to paste code with syntax highlight into the page. You will need to define used programming language.

    will allow you to paste image into the page.

    is list with bullets.

    is list with numbers.

    will allow your to insert slideshare presentation into the page. You need to copy link to presentation and insert it as parameter in this tag.

    will allow your to insert youtube video into the page. You need to copy link to youtube page with video and insert it as parameter in this tag.

    will allow your to insert code snippets from @worker.

    Syntax for editing wiki

    For you are available next options:

    will make text bold.

    will make text italic.

    will make text underlined.

    will make text striked.

    will allow you to paste code headline into the page.

    will allow you to link into the page.

    will allow you to paste code with syntax highlight into the page. You will need to define used programming language.

    will allow you to paste image into the page.

    is list with bullets.

    is list with numbers.

    will allow your to insert slideshare presentation into the page. You need to copy link to presentation and insert it as parameter in this tag.

    will allow your to insert youtube video into the page. You need to copy link to youtube page with video and insert it as parameter in this tag.

    will allow your to insert code snippets from @worker.