summer: An implementation of extensible products and sums

[ data, library, mit ] [ Propose Tags ] [ Report a vulnerability ]

An implementation of extensible products and sums.


[Skip to Readme]

Downloads

Maintainer's Corner

Package maintainers

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, 0.3.7.2
Change log CHANGELOG.md
Dependencies base (>=4.12 && <4.18), generics-sop (>=0.5), profunctors (>=5.6), vector (>=0.12) [details]
Tested with ghc ==8.6.3 || ==8.8.3 || ==8.10.1
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 2023-01-08T06:09:38Z
Distributions
Downloads 2086 total (18 in the last 30 days)
Rating (no votes yet) [estimated by Bayesian average]
Your Rating
  • λ
  • λ
  • λ
Status Docs available [build log]
Last success reported on 2023-01-08 [all 1 reports]

Readme for summer-0.3.7.2

[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.