BSD-3-Clause licensed by Emily Pillmore
Maintained by [email protected]
This version can be pinned in stack with:smash-0.2.0@sha256:f84b4eadfb7d0ae2b1a9e5b32978496f6cff5e55f40de44b93e0df4fedaa9a6d,1879

Module documentation for 0.2.0

smash: Combinators for Maybe types

CI Hackage

This package consists of 3 interesting datatypes and their respective monad transformers:

  • Wedge: Isomorphic to Maybe (Either a b). The Wedge datatype represents the coproduct in the category Hask* of pointed Hask types, called a wedge sum. One can derive this type as follows:

    Either (Maybe a) (Maybe b)
    ~ (1 + a) + (1 + b)
    -- units are the same via pushout
    ~ 1 + a + b
    ~ Maybe (Either a b)
    ~ Wedge a b
    
  • Can: Isomorphic to Maybe (These a b). The Can datatype represents the product in Hask*. One can derive this as follows:

    (Maybe a, Maybe a)
    ~ (1 + a) * (1 + b)
    -- products distribute over coproducts
    ~ 1 + b + a + a*b
    -- coproducts are associative
    ~ 1 + (b + a + a*b)
    ~ 1 + These a b
    ~ Maybe (These a b)
    ~ Can a b
    
  • Smash: Isomorphic to Maybe (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 is the quotient of Can over Wedge. It can be derived as follows:

    Can a b / Wedge a b
    ~ 1 + a + b + a*b / 1 + a + b
    -- reassoc coproduct
    ~ (1 + a + b) + a*b / 1 + a + b
    -- def. of quotient: (1 + a + b) ~ 1
    ~ 1 + a * b
    ~ Maybe (a,b)
    ~ Smash a b
    

Changes

Revision history for smash

0.2.0 – 2026-10-26

  • Start the 0.2 major release series with the 2026 compiler support and test suite.
  • Preserve the existing public API and binary representations.

0.1.4 – 2026-10-26

  • Update dependency bounds and the supported GHC matrix to 9.6–9.14.
  • Update copyrights through 2026.
  • Expose Data.Smash.Internal alongside the other library modules.
  • Add Tasty unit and property tests for data types, instances, and transformers.

0.1.3 – 2022-04-03

  • Update base bounds to allow GHC 9.2.x

0.1.2

  • Add Monad Transformers for Can, Wedge, and Smash (#25)
  • Add Safe haskell pragmas
  • Add instances for all functor classes.
  • Add instances for MonadZip
  • Add nice pointfree definitions for some functions (#24, thanks @subttle!)
  • Add unfolds to the Api.
  • Add template haskell Lift instance (#20, thanks @gergoerdi!)
  • Fixes for various haddock problems (thank you @lemastero and @L7R7!)
  • Bump base to exclude 8.2.x

0.1.1

  • Add NFData, Binary instances
  • CPP to extend to 8.2.2 without warnings

0.1.0.0

  • First version. Released on an unsuspecting world.