Comparing revisions for page haskellComposition
Back to history list== Headline == [[Data composition]] in [[Language:Haskell|]] with [[algebraic data type]]s == 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:A sample company looks like this: [[Feature:Total]] is implemented as follows: The following salary total is computed for the sample company: 399747.0 == Relationships == * See [[Contribution:haskellVariation]] for a contribution with a similar data model such that [[data variation]] is exercised in addition to [[data composition]]. * See [[Contribution:haskellEngineer]] for a contribution with a simple data model without support for departmental nesting. No algebraic data types are leveraged. * See [[Contribution:haskellData]] for a contribution with a simple data model without support for departmental nesting. Algebraic data types are leveraged systematically for all types to distinguish the types nominally. == Architecture == There are these modules: *: a data model for [[Feature:Hierarchical company]] * : a sample company * : the implementation of [[Feature:Total]] * : the implementation of [[Feature:Cut]] * : Tests The types of implement [[Feature:Closed serialization]] through Haskell's read/show. == Usage == See https://github.com/101companies/101haskell/blob/master/README.md. == Metadata == * [[uses::Language:Haskell]] * [[uses::Language:Haskell 98]] * [[uses::Technology:GHC]] * [[uses::Technology:Cabal]] * [[implements::Feature:Hierarchical company]] * [[implements::Feature:Total]] * [[implements::Feature:Cut]] * [[implements::Feature:Closed serialization]] * [[developedBy::Contributor:rlaemmel]] * [[memberOf::Theme:Haskell data]] * [[memberOf::Theme:Haskell introduction]] * [[varies::Contribution:haskellVariation]] * [[basedOn::Contribution:haskellEngineer]]