summer: An implementation of extensible products and sums

[ data, library, mit ] [ Propose Tags ]

An implementation of extensible products and sums.


[Skip to Readme]

Downloads

Maintainer's Corner

For package maintainers and hackage trustees

Candidates

  • No Candidates
Versions [RSS] 0.1.0.0, 0.1.1.0, 0.1.2.0, 0.2.0.1, 0.3.0.0, 0.3.1.0, 0.3.1.1, 0.3.2.0, 0.3.4.0, 0.3.5.0, 0.3.6.0, 0.3.7.0, 0.3.7.1
Change log CHANGELOG.md
Dependencies base (>=4.12 && <4.16), generics-sop (>=0.5), profunctors (>=5.6), vector (>=0.12) [details]
License MIT
Copyright 2020 Samuel Schlesinger
Author Samuel Schlesinger
Maintainer sgschlesinger@gmail.com
Category Data
Source repo head: git clone https://github.com/samuelschlesinger/summer
Uploaded by sgschlesinger at 2021-09-11T02:57:52Z
Distributions NixOS:0.3.7.1
Downloads 1486 total (14 in the last 30 days)
Rating (no votes yet) [estimated by Bayesian average]
Your Rating
  • λ
  • λ
  • λ
Status Docs available [build log]
Last success reported on 2021-09-11 [all 1 reports]

Readme for summer-0.3.7.1

[back to package description]

summer

Hackage Build Status

Extensible sums and products for Haskell.

x :: Sum '[Int, Bool, Float]
x = Inj True

y :: Sum '[Int, Float, Bool, Char]
y = weaken x

a :: Bool
a = match y (== 10) (== 0.2) id (== 'x')

x' :: Prod '[Int, Float, Bool, Char]
x' = produce $ \f -> f 10 0.2 True 'x'

y' :: Prod '[Bool, Float]
y' = strengthen x'

a' :: Bool
a' = consume y' (\b f -> b && f == 0.2)

q :: Bool
q = select x' $ \b (f :: Float)-> b && f == 0.2

This package is extremely experimental, and is subject to arbitrarily large changes.