packages feed

semiring-simple 0.2.0.0 → 0.2.1.0

raw patch · 2 files changed

+41/−45 lines, 2 filesdep ~basePVP: major bump suggested

API removals or changes: PVP suggests a major version bump

Dependency ranges changed: base

API changes (from Hackage documentation)

+ Data.Semiring: instance Num a => Semiring a
+ Data.Semiring: instance Semiring Bool
+ Data.Semiring: instance Semiring a => Monoid a
- Data.Semiring: class Eq s => Semiring s
+ Data.Semiring: class Semiring s

Files

semiring-simple.cabal view
@@ -1,54 +1,25 @@ -- Initial semiring.cabal generated by cabal init.  For further  -- documentation, see http://haskell.org/cabal/users-guide/ --- The name of the package. name:                semiring-simple---- The package version.  See the Haskell package versioning policy (PVP) --- for standards guiding when and how versions should be incremented.--- http://www.haskell.org/haskellwiki/Package_versioning_policy--- PVP summary:      +-+------- breaking API changes---                   | | +----- non-breaking API additions---                   | | | +--- code changes with no API change-version:             0.2.0.0---- A short (one-line) description of the package.+version:             0.2.1.0 synopsis:            A module for dealing with semirings.---- A longer description of the package.-description:         Semirings are like normal rings, except you can't subtract. This library provides a type class for semirings.---- The license under which the package is released.+description:+  Semirings are like normal rings, except you can't subtract. This library+  provides a type class for semirings. license:             BSD3---- The file containing the license text. license-file:        LICENSE---- The package author(s). author:              Thomas Wilke, Frank Huch, Sebastian Fischer, Peter Harpending---- An email address to which users can send suggestions, bug reports, and --- patches.-maintainer:          pharpend2@gmail.com---- A copyright notice.--- copyright:           2014-+maintainer:          Peter Harpending <pharpend2@gmail.com>+copyright:           2014, Peter Harpending. category:            Math- build-type:          Simple---- Extra files to be distributed with the package, such as examples or a --- README. extra-source-files:  README.md---- Constraint on the version of Cabal needed to build this package. cabal-version:       >=1.10 - library-  -- Modules exported by the library.-  exposed-modules:     Data.Semiring+  exposed-modules:+      Data.Semiring      -- Modules included in this library but not exported.   -- other-modules:       @@ -57,7 +28,8 @@   -- other-extensions:          -- Other library packages from which modules are imported.-  build-depends:       base >=4.7 && <4.8+  build-depends:+      base >=4 && <5      -- Directories containing source files.   hs-source-dirs:      src/@@ -65,7 +37,6 @@   -- Base language which the package is written in.   default-language:    Haskell2010   - source-repository head   type:       git   location:   https://github.com/pharpend/semiring.git
src/Data/Semiring.hs view
@@ -1,15 +1,24 @@-{-| -Module      : Data.Semiring-Copyright   : Thomas Wilke, Frank Huch, Sebastian Fischer, Peter Harpending-License     : BSD3-Maintainer  : Peter Harpending <pharpend2@gmail.com>+{-# LANGUAGE FlexibleInstances #-}+{-# LANGUAGE UndecidableInstances #-} +{- |+Module       : Data.Semiring.Tropical.Skel+Description  : A module for Tropical whatever+Copyright    : 2012, Thomas Wilke, Frank Huch, Sebastian Fischer+               2014, Peter Harpending+License      : BSD3+Maintainer   : Peter Harpending <pharpend2@gmail.com>+Stability    : experimental+Portability  : archlinux+ This library provides a type class for semirings.  -}  module Data.Semiring where +import Data.Monoid+ -- | -- A semiring is an additive commutative monoid with identity 'zero': -- @@ -32,6 +41,22 @@ --  -- > zero .*. a  ==  zero -- > a .*. zero  ==  zero-class (Eq s) => Semiring s where+class Semiring s where   zero, one    :: s   (.+.), (.*.) :: s -> s -> s++instance Semiring a => Monoid a where+  mempty = zero+  mappend = (.+.)++instance Num a => Semiring a where+  zero = 0+  one = 1+  (.+.) = (+)+  (.*.) = (*)++instance Semiring Bool where+  zero = False+  one = True+  (.+.) = (||)+  (.*.) = (&&)