Copyright | (C) 2018 chessai |
---|---|
License | MIT (see the file LICENSE) |
Maintainer | chessai <chessai1996@gmail.com> |
Stability | provisional |
Portability | portable |
Safe Haskell | None |
Language | Haskell98 |
Data.Semiring.Generic
Contents
Description
This module provides generic deriving tools for semirings and rings for product-like structures.
Synopsis
- class GSemiring f where
- gzero :: (Generic a, GSemiring (Rep a)) => a
- gone :: (Generic a, GSemiring (Rep a)) => a
- gplus :: (Generic a, GSemiring (Rep a)) => a -> a -> a
- gtimes :: (Generic a, GSemiring (Rep a)) => a -> a -> a
- class GRing f where
- gnegate' :: f a -> f a
- gnegate :: (Generic a, GRing (Rep a)) => a -> a
- newtype GenericSemiring a = GenericSemiring a
Documentation
class GSemiring f where Source #
Generic Semiring
class, used to implement plus
, times
, zero
,
and one
for product-like types implementing Generic
.
Methods
gplus' :: f a -> f a -> f a Source #
gtimes' :: f a -> f a -> f a Source #
gfromNatural' :: Natural -> f a Source #
newtype GenericSemiring a Source #
An Identity-style wrapper with a Generic
interface
to be used with '-XDerivingVia'.
Constructors
GenericSemiring a |
Instances
Generic (GenericSemiring a) Source # | |
Defined in Data.Semiring.Generic Associated Types type Rep (GenericSemiring a) :: Type -> Type # Methods from :: GenericSemiring a -> Rep (GenericSemiring a) x # to :: Rep (GenericSemiring a) x -> GenericSemiring a # | |
Semiring a => Semiring (GenericSemiring a) Source # | |
Defined in Data.Semiring.Generic Methods plus :: GenericSemiring a -> GenericSemiring a -> GenericSemiring a Source # zero :: GenericSemiring a Source # times :: GenericSemiring a -> GenericSemiring a -> GenericSemiring a Source # one :: GenericSemiring a Source # fromNatural :: Natural -> GenericSemiring a Source # | |
type Rep (GenericSemiring a) Source # | |
Defined in Data.Semiring.Generic type Rep (GenericSemiring a) = D1 (MetaData "GenericSemiring" "Data.Semiring.Generic" "semirings-0.4.2-1rmjzE2ZZV5G06OfByOmSn" True) (C1 (MetaCons "GenericSemiring" PrefixI False) (S1 (MetaSel (Nothing :: Maybe Symbol) NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 a))) |
Orphan instances
(Ring a, Ring b) => Ring (a, b) Source # | |
(Semiring a, Semiring b) => Semiring (a, b) Source # | |
(Ring a, Ring b, Ring c) => Ring (a, b, c) Source # | |
(Semiring a, Semiring b, Semiring c) => Semiring (a, b, c) Source # | |
(Ring a, Ring b, Ring c, Ring d) => Ring (a, b, c, d) Source # | |
(Semiring a, Semiring b, Semiring c, Semiring d) => Semiring (a, b, c, d) Source # | |
(Ring a, Ring b, Ring c, Ring d, Ring e) => Ring (a, b, c, d, e) Source # | |
(Semiring a, Semiring b, Semiring c, Semiring d, Semiring e) => Semiring (a, b, c, d, e) Source # | |
(Ring a, Ring b, Ring c, Ring d, Ring e, Ring f) => Ring (a, b, c, d, e, f) Source # | |
(Semiring a, Semiring b, Semiring c, Semiring d, Semiring e, Semiring f) => Semiring (a, b, c, d, e, f) Source # | |
(Ring a, Ring b, Ring c, Ring d, Ring e, Ring f, Ring g) => Ring (a, b, c, d, e, f, g) Source # | |
(Semiring a, Semiring b, Semiring c, Semiring d, Semiring e, Semiring f, Semiring g) => Semiring (a, b, c, d, e, f, g) Source # | |
Methods plus :: (a, b, c, d, e, f, g) -> (a, b, c, d, e, f, g) -> (a, b, c, d, e, f, g) Source # zero :: (a, b, c, d, e, f, g) Source # times :: (a, b, c, d, e, f, g) -> (a, b, c, d, e, f, g) -> (a, b, c, d, e, f, g) Source # one :: (a, b, c, d, e, f, g) Source # fromNatural :: Natural -> (a, b, c, d, e, f, g) Source # |