semirings-0.7: two monoids as one, in holy haskimony

Safe Haskell | None
Language | Haskell98

Data.Star

Description

A class for *-semirings (pron. "star-semirings").

Synopsis

- class Semiring a => Star a where
  - star :: a -> a
  - aplus :: a -> a

# Documentation

class Semiring a => Star a where Source #

A Star semiring adds one operation, `star` to a `Semiring`, such that it follows the law:

    star x = one + x * star x = one + star x * x

Another operation, `aplus`, can be defined in terms of `star`:

    aplus x = x * star x

Minimal complete definition

star | aplus

Methods

star :: a -> a Source #

aplus :: a -> a Source #

#### Instances

Instances details

Star Mod2 Source # |
Instance details Defined in Data.Star Methods star :: Mod2 -> Mod2 Source # aplus :: Mod2 -> Mod2 Source #
Star () Source # |
Instance details Defined in Data.Star Methods star :: () -> () Source # aplus :: () -> () Source #
Star Bool Source # |
Instance details Defined in Data.Star Methods star :: Bool -> Bool Source # aplus :: Bool -> Bool Source #
Star (Proxy a) Source # |
Instance details Defined in Data.Star Methods star :: Proxy a -> Proxy a Source # aplus :: Proxy a -> Proxy a Source #
(Ord a, Monoid a, Extremum e) => Star (Tropical e a) Source # |
Instance details Defined in Data.Semiring.Tropical Methods star :: Tropical e a -> Tropical e a Source # aplus :: Tropical e a -> Tropical e a Source #
Star b => Star (a -> b) Source # |
Instance details Defined in Data.Star Methods star :: (a -> b) -> a -> b Source # aplus :: (a -> b) -> a -> b Source #