named-sop: Dependently-typed sums and products, tagged by field name

[ data, library, mit ] [ Propose Tags ]

Sums and Maps (products) indexed by a typelevel map of their field (or constructor) names and types. They can be combined and split again; their typelevel map is sorted to ensure that the end result is independent of the order you combine it in.

Data.NamedSOP.Generic contains functions for automatically converting between types with a Generic instance and named sums of products:

>>> data A = C { a :: Int, b :: Bool }
>>>          | D Int Bool deriving (Generic)
>>> :t genSum (C 3 True)
NSum
 '[ "_C" ':-> NMap '[ "a" ':-> Int, "b" ':-> Bool],
    "_D" ':-> NMap '[ "_1" ':-> Int, "_2" ':-> Bool]]

[Skip to Readme]

Modules

[Last Documentation]

  • Data
    • NamedSOP
      • Data.NamedSOP.Generic
      • Data.NamedSOP.Map
      • Data.NamedSOP.Sum
      • Data.NamedSOP.Type

Downloads

Maintainer's Corner

Package maintainers

For package maintainers and hackage trustees

Candidates

Versions [RSS] 0.1.0.0, 0.1.0.1, 0.2.0.0, 0.3.0.0
Change log CHANGELOG.md
Dependencies base (>=4.13.0.0 && <4.14), singletons (>=2.6 && <2.7), text (>=1.2.3.1 && <1.3) [details]
License MIT
Author Sam Schweigel
Maintainer Sam Schweigel <s.schweigel@gmail.com>
Category Data
Home page https://github.com/sjsch/named-sop
Source repo head: git clone https://github.com/sjsch/named-sop
Uploaded by sjsch at 2020-02-20T03:02:24Z
Distributions
Downloads 1498 total (11 in the last 30 days)
Rating (no votes yet) [estimated by Bayesian average]
Your Rating
  • λ
  • λ
  • λ
Status Docs not available [build log]
All reported builds failed as of 2020-02-20 [all 3 reports]

Readme for named-sop-0.3.0.0

[back to package description]

named-sop: Dependently-typed sums and products, tagged by field name

Hackage Build Status

Sums and Maps (products) indexed by a typelevel map of their field (or constructor) names and types. They can be combined and split again; their typelevel map is sorted to ensure that the end result is independent of the order you combine it in.

"Data.NamedSOP.Generic" contains functions for automatically converting between types with a Generic instance and named sums of products:

>>> data A = C { a :: Int, b :: Bool } 
>>>          | D Int Bool deriving (Generic)
>>> :t genSum (C 3 True)
NSum
 '[ "_C" ':-> NMap '[ "a" ':-> Int, "b" ':-> Bool],
    "_D" ':-> NMap '[ "_1" ':-> Int, "_2" ':-> Bool]]