semiring-simple (empty) → 0.1.0.0
raw patch · 5 files changed
+160/−0 lines, 5 filesdep +basesetup-changed
Dependencies added: base
Files
- Data/Semiring.hs +50/−0
- LICENSE +30/−0
- README.md +7/−0
- Setup.hs +2/−0
- semiring-simple.cabal +71/−0
+ Data/Semiring.hs view
@@ -0,0 +1,50 @@+-- | +-- Module : Data.Semiring+-- Copyright : Thomas Wilke, Frank Huch, Sebastian Fischer, Peter Harpending+-- License : BSD3+-- Maintainer : Peter Harpending <pharpend2@gmail.com>+-- +-- This library provides a type class for semirings.+-- ++module Data.Semiring where++-- |+-- A semiring is an additive commutative monoid with identity 'zero':+-- +-- > a .+. b == b .+. a+-- > zero .+. a == a+-- > (a .+. b) .+. c == a .+. (b .+. c)+-- +-- A semiring is a multiplicative monoid with identity 'one':+-- +-- > one .*. a == a+-- > a .*. one == a+-- > (a .*. b) .*. c == a .*. (b .*. c)+-- +-- Multiplication distributes over addition:+-- +-- > a .*. (b .+. c) == (a .*. b) .+. (a .*. c)+-- > (a .+. b) .*. c == (a .*. c) .+. (b .*. c)+-- +-- 'zero' annihilates a semiring with respect to multiplication:+-- +-- > zero .*. a == zero+-- > a .*. zero == zero+-- +-- All laws should hold with respect to the required `Eq` instance.+-- +-- For example, the Booleans form a semiring.+-- +-- * @False@ is an identity of disjunction which is commutative and+-- associative,+-- +-- * @True@ is an identity of conjunction which is associative,+-- +-- * conjunction distributes over disjunction, and+-- +-- * @False@ annihilates the Booleans with respect to conjunction.+-- +class (Eq s) => Semiring s where+ zero, one :: s+ (.+.), (.*.) :: s -> s -> s
+ LICENSE view
@@ -0,0 +1,30 @@+Copyright (c) 2014, Thomas Wilke, Frank Huch, Sebastian Fischer, Peter Harpending++All rights reserved.++Redistribution and use in source and binary forms, with or without+modification, are permitted provided that the following conditions are met:++ * Redistributions of source code must retain the above copyright+ notice, this list of conditions and the following disclaimer.++ * Redistributions in binary form must reproduce the above+ copyright notice, this list of conditions and the following+ disclaimer in the documentation and/or other materials provided+ with the distribution.++ * Neither the name of Thomas Wilke, Frank Huch, Sebastian Fischer, Peter Harpending nor the names of other+ contributors may be used to endorse or promote products derived+ from this software without specific prior written permission.++THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS+"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT+LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR+A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT+OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,+SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT+LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,+DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY+THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE+OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ README.md view
@@ -0,0 +1,7 @@+# Semiring++This is a Haskell library for dealing with semirings.++The source file comes from the apparently abandoned+[weighted-regexp](http://hackage.haskell.org/package/weighted-regexp-0.3.1.2)+package on Hackage.
+ Setup.hs view
@@ -0,0 +1,2 @@+import Distribution.Simple+main = defaultMain
+ semiring-simple.cabal view
@@ -0,0 +1,71 @@+-- 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.1.0.0++-- A short (one-line) description of the package.+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.+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++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+ + -- Modules included in this library but not exported.+ -- other-modules: + + -- LANGUAGE extensions used by modules in this package.+ -- other-extensions: + + -- Other library packages from which modules are imported.+ build-depends: base >=4.6 && <4.7+ + -- Directories containing source files.+ -- hs-source-dirs: + + -- Base language which the package is written in.+ default-language: Haskell2010+ ++source-repository head+ type: git+ location: https://github.com/pharpend/semiring.git