smash: Combinators for Maybe types

[ bsd3, data, library ] [ Propose Tags ]

This package provides the calculus for pointed types, including the pointed product, Can, the pointed coproduct, Wedge, and the smash product.


[Skip to Readme]

Downloads

Note: This package has metadata revisions in the cabal description newer than included in the tarball. To unpack the package including the revisions, use 'cabal get'.

Maintainer's Corner

Package maintainers

For package maintainers and hackage trustees

Candidates

Versions [RSS] 0.1.0.0, 0.1.1.0, 0.1.2, 0.1.3
Change log CHANGELOG.md
Dependencies base (>=4.10 && <5.0), bifunctors (>=5.5 && <5.6), binary (>=0.8 && <0.9), deepseq (>=1.4 && <1.5), hashable (>=1.3 && <1.4) [details]
License BSD-3-Clause
Copyright (c) 2020 Emily Pillmore <emilypi@cohomolo.gy>
Author Emily Pillmore
Maintainer emilypi@cohomolo.gy
Revised Revision 1 made by topos at 2020-04-07T16:38:04Z
Category Data
Home page https://github.com/emilypi/smash
Bug tracker https://github.com/emilypi/smash/issues
Source repo head: git clone https://github.com/emilypi/smash.git
Uploaded by topos at 2020-04-07T16:36:37Z
Distributions
Reverse Dependencies 5 direct, 0 indirect [details]
Downloads 876 total (13 in the last 30 days)
Rating (no votes yet) [estimated by Bayesian average]
Your Rating
  • λ
  • λ
  • λ
Status Docs available [build log]
Last success reported on 2020-04-07 [all 1 reports]

Readme for smash-0.1.1.0

[back to package description]

smash: Combinators for Maybe types

Build Status Hackage

This package consists of 3 datatypes: Wedge, Can, and Smash.

You can imagine these three types as Maybe (Either a b), Maybe (Either a (Either b (a,b)), and Maybe (These a b) respectively. It turns out that that each of these datatypes has spcial properties:

  • the Wedge datatype represents the coproduct (like, Either) in the category Hask* of pointed Hask types, called a wedge sum. One can derive this by noting that units are the same in Haskell, and the sum of two pointed types is (1 + a) + (1 + b) ~ 1 + a + b ~ Wedge a b.

  • the Can datatype represents the product (like, (,)) in Hask*. You can derive this by considering the product of two pointed types (1 + a) * (1 + b) ~ 1 + a + b + a*b ~ Can a b.

  • the Smash datatype represents a special type of product, a smash product, in the category Hask*. The smash product is a symmetric, monoidal tensor in Hask* that plays nicely with the product, 'Can', and coproduct, 'Wedge'.

Pictorially, these datatypes look like this:

'Can':
        a
        |
Non +---+---+ (a,b)
        |
        b

'Wedge':
                a
                |
Nowhere +-------+
                |
                b


'Smash':


Nada +--------+ (a,b)