set-cover 0.0.8 → 0.0.9
raw patch · 4 files changed
+20/−6 lines, 4 filesdep +semigroupsdep ~basedep ~containersdep ~enummapset
Dependencies added: semigroups
Dependency ranges changed: base, containers, enummapset
Files
- example/Domino.hs +7/−3
- set-cover.cabal +4/−2
- src/Math/SetCover/BitMap.hs +4/−0
- src/Math/SetCover/BitSet.hs +5/−1
example/Domino.hs view
@@ -38,6 +38,7 @@ import Control.Applicative (pure) import Data.Set (Set) import Data.Monoid (Monoid, mempty, mappend, mconcat)+import Data.Semigroup (Semigroup, (<>)) data@@ -57,13 +58,16 @@ type Assign = ESC.Assign Borders (Set X) -instance Monoid Borders where- mempty = Borders mempty mempty- mappend x y =+instance Semigroup Borders where+ x <> y = Borders { vertical = Set.union (vertical x) (vertical y), horizontal = Set.union (horizontal x) (horizontal y) }++instance Monoid Borders where+ mempty = Borders mempty mempty+ mappend = (<>) above, left :: Position -> Position
set-cover.cabal view
@@ -1,5 +1,5 @@ Name: set-cover-Version: 0.0.8+Version: 0.0.9 License: BSD3 License-File: LICENSE Author: Henning Thielemann, Helmut Podhaisky@@ -32,7 +32,7 @@ default: False Source-Repository this- Tag: 0.0.8+ Tag: 0.0.9 Type: darcs Location: http://hub.darcs.net/thielema/set-cover/ @@ -45,6 +45,7 @@ psqueues >=0.2 && <0.3, enummapset >=0.1 && <0.6, containers >=0.4 && <0.6,+ semigroups >=0.1 && <1.0, utility-ht >=0.0.12 && <0.1, base >=4 && <5 @@ -193,6 +194,7 @@ set-cover, unicode >=0.0 && <0.1, containers,+ semigroups, utility-ht, base Else
src/Math/SetCover/BitMap.hs view
@@ -15,12 +15,16 @@ import qualified Data.List.Reverse.StrictSpine as ListRev import Data.Monoid (Monoid, mempty, mappend)+import Data.Semigroup (Semigroup, (<>)) {- Sliced representation of Map [0..bitSize-1] Integer. -} newtype Map bits = Map {unMap :: [bits]} deriving (Show)++instance (Bit.C bits) => Semigroup (Map bits) where+ (<>) = add instance (Bit.C bits) => Monoid (Map bits) where mempty = Map []
src/Math/SetCover/BitSet.hs view
@@ -4,13 +4,17 @@ import Math.SetCover.Bit ((.|.), (.&.)) import Data.Monoid (Monoid, mempty, mappend)+import Data.Semigroup (Semigroup, (<>)) newtype Set bits = Set bits deriving (Eq, Ord, Show) +instance (Bit.C bits) => Semigroup (Set bits) where+ Set x <> Set y = Set $ x.|.y+ instance (Bit.C bits) => Monoid (Set bits) where mempty = empty- mappend (Set x) (Set y) = Set $ x.|.y+ mappend = (<>) empty :: Bit.C bits => Set bits empty = Set Bit.empty