lattices 1.1 → 1.2
raw patch · 3 files changed
+29/−9 lines, 3 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
- Algebra.Enumerable: instance (Enumerable a) => Enumerable (Enumerated a)
- Algebra.Enumerable: instance (Enumerable a) => Enumerable (Maybe a)
- Algebra.Enumerable: instance (Eq a) => Eq (Enumerated a)
- Algebra.Enumerable: instance (Ord a) => Ord (Enumerated a)
- Algebra.Lattice: instance (BoundedJoinSemiLattice v) => BoundedJoinSemiLattice (k -> v)
- Algebra.Lattice: instance (BoundedLattice v) => BoundedLattice (k -> v)
- Algebra.Lattice: instance (BoundedMeetSemiLattice v) => BoundedMeetSemiLattice (k -> v)
- Algebra.Lattice: instance (JoinSemiLattice v) => BoundedJoinSemiLattice (IntMap v)
- Algebra.Lattice: instance (JoinSemiLattice v) => JoinSemiLattice (IntMap v)
- Algebra.Lattice: instance (JoinSemiLattice v) => JoinSemiLattice (k -> v)
- Algebra.Lattice: instance (Lattice v) => Lattice (k -> v)
- Algebra.Lattice: instance (MeetSemiLattice v) => MeetSemiLattice (k -> v)
- Algebra.Lattice: instance (Ord a) => BoundedJoinSemiLattice (Set a)
- Algebra.Lattice: instance (Ord a) => JoinSemiLattice (Set a)
- Algebra.Lattice.Dropped: instance (BoundedJoinSemiLattice a) => BoundedJoinSemiLattice (Dropped a)
- Algebra.Lattice.Dropped: instance (BoundedLattice a) => BoundedLattice (Dropped a)
- Algebra.Lattice.Dropped: instance (JoinSemiLattice a) => JoinSemiLattice (Dropped a)
- Algebra.Lattice.Dropped: instance (Lattice a) => Lattice (Dropped a)
- Algebra.Lattice.Dropped: instance (MeetSemiLattice a) => BoundedMeetSemiLattice (Dropped a)
- Algebra.Lattice.Dropped: instance (MeetSemiLattice a) => MeetSemiLattice (Dropped a)
- Algebra.Lattice.Levitated: instance (BoundedLattice a) => BoundedLattice (Levitated a)
- Algebra.Lattice.Levitated: instance (JoinSemiLattice a) => BoundedJoinSemiLattice (Levitated a)
- Algebra.Lattice.Levitated: instance (JoinSemiLattice a) => JoinSemiLattice (Levitated a)
- Algebra.Lattice.Levitated: instance (Lattice a) => Lattice (Levitated a)
- Algebra.Lattice.Levitated: instance (MeetSemiLattice a) => BoundedMeetSemiLattice (Levitated a)
- Algebra.Lattice.Levitated: instance (MeetSemiLattice a) => MeetSemiLattice (Levitated a)
- Algebra.Lattice.Lifted: instance (BoundedLattice a) => BoundedLattice (Lifted a)
- Algebra.Lattice.Lifted: instance (BoundedMeetSemiLattice a) => BoundedMeetSemiLattice (Lifted a)
- Algebra.Lattice.Lifted: instance (JoinSemiLattice a) => BoundedJoinSemiLattice (Lifted a)
- Algebra.Lattice.Lifted: instance (JoinSemiLattice a) => JoinSemiLattice (Lifted a)
- Algebra.Lattice.Lifted: instance (Lattice a) => Lattice (Lifted a)
- Algebra.Lattice.Lifted: instance (MeetSemiLattice a) => MeetSemiLattice (Lifted a)
- Algebra.PartialOrd: instance (Ord a) => PartialOrd (Set a)
+ Algebra.Enumerable: instance Enumerable a => Enumerable (Enumerated a)
+ Algebra.Enumerable: instance Enumerable a => Enumerable (Maybe a)
+ Algebra.Enumerable: instance Eq a => Eq (Enumerated a)
+ Algebra.Enumerable: instance Ord a => Ord (Enumerated a)
+ Algebra.Lattice: gfpFrom :: (Eq a, BoundedMeetSemiLattice a) => a -> (a -> a) -> a
+ Algebra.Lattice: instance BoundedJoinSemiLattice v => BoundedJoinSemiLattice (k -> v)
+ Algebra.Lattice: instance BoundedLattice v => BoundedLattice (k -> v)
+ Algebra.Lattice: instance BoundedMeetSemiLattice v => BoundedMeetSemiLattice (k -> v)
+ Algebra.Lattice: instance JoinSemiLattice v => BoundedJoinSemiLattice (IntMap v)
+ Algebra.Lattice: instance JoinSemiLattice v => JoinSemiLattice (IntMap v)
+ Algebra.Lattice: instance JoinSemiLattice v => JoinSemiLattice (k -> v)
+ Algebra.Lattice: instance Lattice v => Lattice (k -> v)
+ Algebra.Lattice: instance MeetSemiLattice v => MeetSemiLattice (k -> v)
+ Algebra.Lattice: instance Ord a => BoundedJoinSemiLattice (Set a)
+ Algebra.Lattice: instance Ord a => JoinSemiLattice (Set a)
+ Algebra.Lattice: lfpFrom :: (Eq a, BoundedJoinSemiLattice a) => a -> (a -> a) -> a
+ Algebra.Lattice.Dropped: instance BoundedJoinSemiLattice a => BoundedJoinSemiLattice (Dropped a)
+ Algebra.Lattice.Dropped: instance BoundedLattice a => BoundedLattice (Dropped a)
+ Algebra.Lattice.Dropped: instance JoinSemiLattice a => JoinSemiLattice (Dropped a)
+ Algebra.Lattice.Dropped: instance Lattice a => Lattice (Dropped a)
+ Algebra.Lattice.Dropped: instance MeetSemiLattice a => BoundedMeetSemiLattice (Dropped a)
+ Algebra.Lattice.Dropped: instance MeetSemiLattice a => MeetSemiLattice (Dropped a)
+ Algebra.Lattice.Levitated: instance BoundedLattice a => BoundedLattice (Levitated a)
+ Algebra.Lattice.Levitated: instance JoinSemiLattice a => BoundedJoinSemiLattice (Levitated a)
+ Algebra.Lattice.Levitated: instance JoinSemiLattice a => JoinSemiLattice (Levitated a)
+ Algebra.Lattice.Levitated: instance Lattice a => Lattice (Levitated a)
+ Algebra.Lattice.Levitated: instance MeetSemiLattice a => BoundedMeetSemiLattice (Levitated a)
+ Algebra.Lattice.Levitated: instance MeetSemiLattice a => MeetSemiLattice (Levitated a)
+ Algebra.Lattice.Lifted: instance BoundedLattice a => BoundedLattice (Lifted a)
+ Algebra.Lattice.Lifted: instance BoundedMeetSemiLattice a => BoundedMeetSemiLattice (Lifted a)
+ Algebra.Lattice.Lifted: instance JoinSemiLattice a => BoundedJoinSemiLattice (Lifted a)
+ Algebra.Lattice.Lifted: instance JoinSemiLattice a => JoinSemiLattice (Lifted a)
+ Algebra.Lattice.Lifted: instance Lattice a => Lattice (Lifted a)
+ Algebra.Lattice.Lifted: instance MeetSemiLattice a => MeetSemiLattice (Lifted a)
+ Algebra.PartialOrd: instance Ord a => PartialOrd (Set a)
+ Algebra.PartialOrd: instance PartialOrd IntSet
+ Algebra.PartialOrd: instance PartialOrd v => PartialOrd (IntMap v)
- Algebra.Enumerable: universe :: (Enumerable a) => [a]
+ Algebra.Enumerable: universe :: Enumerable a => [a]
- Algebra.Lattice: bottom :: (BoundedJoinSemiLattice a) => a
+ Algebra.Lattice: bottom :: BoundedJoinSemiLattice a => a
- Algebra.Lattice: class (JoinSemiLattice a) => BoundedJoinSemiLattice a
+ Algebra.Lattice: class JoinSemiLattice a => BoundedJoinSemiLattice a
- Algebra.Lattice: class (MeetSemiLattice a) => BoundedMeetSemiLattice a
+ Algebra.Lattice: class MeetSemiLattice a => BoundedMeetSemiLattice a
- Algebra.Lattice: join :: (JoinSemiLattice a) => a -> a -> a
+ Algebra.Lattice: join :: JoinSemiLattice a => a -> a -> a
- Algebra.Lattice: joins :: (BoundedJoinSemiLattice a) => [a] -> a
+ Algebra.Lattice: joins :: BoundedJoinSemiLattice a => [a] -> a
- Algebra.Lattice: joins1 :: (JoinSemiLattice a) => [a] -> a
+ Algebra.Lattice: joins1 :: JoinSemiLattice a => [a] -> a
- Algebra.Lattice: meet :: (MeetSemiLattice a) => a -> a -> a
+ Algebra.Lattice: meet :: MeetSemiLattice a => a -> a -> a
- Algebra.Lattice: meets :: (BoundedMeetSemiLattice a) => [a] -> a
+ Algebra.Lattice: meets :: BoundedMeetSemiLattice a => [a] -> a
- Algebra.Lattice: meets1 :: (MeetSemiLattice a) => [a] -> a
+ Algebra.Lattice: meets1 :: MeetSemiLattice a => [a] -> a
- Algebra.Lattice: top :: (BoundedMeetSemiLattice a) => a
+ Algebra.Lattice: top :: BoundedMeetSemiLattice a => a
- Algebra.PartialOrd: class (Eq a) => PartialOrd a
+ Algebra.PartialOrd: class Eq a => PartialOrd a
- Algebra.PartialOrd: gfpFrom :: (PartialOrd a) => a -> (a -> a) -> a
+ Algebra.PartialOrd: gfpFrom :: PartialOrd a => a -> (a -> a) -> a
- Algebra.PartialOrd: leq :: (PartialOrd a) => a -> a -> Bool
+ Algebra.PartialOrd: leq :: PartialOrd a => a -> a -> Bool
- Algebra.PartialOrd: lfpFrom :: (PartialOrd a) => a -> (a -> a) -> a
+ Algebra.PartialOrd: lfpFrom :: PartialOrd a => a -> (a -> a) -> a
- Algebra.PartialOrd: partialOrdEq :: (PartialOrd a) => a -> a -> Bool
+ Algebra.PartialOrd: partialOrdEq :: PartialOrd a => a -> a -> Bool
- Algebra.PartialOrd: unsafeGfpFrom :: (Eq a) => a -> (a -> a) -> a
+ Algebra.PartialOrd: unsafeGfpFrom :: Eq a => a -> (a -> a) -> a
- Algebra.PartialOrd: unsafeLfpFrom :: (Eq a) => a -> (a -> a) -> a
+ Algebra.PartialOrd: unsafeLfpFrom :: Eq a => a -> (a -> a) -> a
Files
- Algebra/Lattice.hs +19/−7
- Algebra/PartialOrd.hs +9/−1
- lattices.cabal +1/−1
Algebra/Lattice.hs view
@@ -9,12 +9,12 @@ joins, meets, -- * Fixed points of chains in lattices- lfp, unsafeLfp,- gfp, unsafeGfp,+ lfp, lfpFrom, unsafeLfp,+ gfp, gfpFrom, unsafeGfp, ) where import Algebra.Enumerable-import Algebra.PartialOrd+import qualified Algebra.PartialOrd as PO import qualified Data.Set as S import qualified Data.IntSet as IS@@ -210,23 +210,35 @@ -- Assumes that the function is monotone and does not check if that is correct. {-# INLINE unsafeLfp #-} unsafeLfp :: (Eq a, BoundedJoinSemiLattice a) => (a -> a) -> a-unsafeLfp = unsafeLfpFrom bottom+unsafeLfp = PO.unsafeLfpFrom bottom -- | Implementation of Kleene fixed-point theorem <http://en.wikipedia.org/wiki/Kleene_fixed-point_theorem>. -- Forces the function to be monotone. {-# INLINE lfp #-} lfp :: (Eq a, BoundedJoinSemiLattice a) => (a -> a) -> a-lfp f = unsafeLfpFrom bottom (\x -> f x `join` x)+lfp = lfpFrom bottom +-- | Implementation of Kleene fixed-point theorem <http://en.wikipedia.org/wiki/Kleene_fixed-point_theorem>.+-- Forces the function to be monotone.+{-# INLINE lfpFrom #-}+lfpFrom :: (Eq a, BoundedJoinSemiLattice a) => a -> (a -> a) -> a+lfpFrom init_x f = PO.unsafeLfpFrom init_x (\x -> f x `join` x) + -- | Implementation of Kleene fixed-point theorem <http://en.wikipedia.org/wiki/Kleene_fixed-point_theorem>. -- Assumes that the function is antinone and does not check if that is correct. {-# INLINE unsafeGfp #-} unsafeGfp :: (Eq a, BoundedMeetSemiLattice a) => (a -> a) -> a-unsafeGfp = unsafeGfpFrom top+unsafeGfp = PO.unsafeGfpFrom top -- | Implementation of Kleene fixed-point theorem <http://en.wikipedia.org/wiki/Kleene_fixed-point_theorem>. -- Forces the function to be antinone. {-# INLINE gfp #-} gfp :: (Eq a, BoundedMeetSemiLattice a) => (a -> a) -> a-gfp f = unsafeGfpFrom top (\x -> f x `meet` x)+gfp = gfpFrom top++-- | Implementation of Kleene fixed-point theorem <http://en.wikipedia.org/wiki/Kleene_fixed-point_theorem>.+-- Forces the function to be antinone.+{-# INLINE gfpFrom #-}+gfpFrom :: (Eq a, BoundedMeetSemiLattice a) => a -> (a -> a) -> a+gfpFrom init_x f = PO.unsafeGfpFrom init_x (\x -> f x `meet` x)
Algebra/PartialOrd.hs view
@@ -11,7 +11,9 @@ import Algebra.Enumerable import qualified Data.Set as S+import qualified Data.IntSet as IS import qualified Data.Map as M+import qualified Data.IntMap as IM -- | A partial ordering on sets: <http://en.wikipedia.org/wiki/Partially_ordered_set>@@ -38,8 +40,14 @@ instance Ord a => PartialOrd (S.Set a) where leq = S.isSubsetOf +instance PartialOrd IS.IntSet where+ leq = IS.isSubsetOf+ instance (Ord k, PartialOrd v) => PartialOrd (M.Map k v) where- leq = M.isSubmapOf+ m1 `leq` m2 = m1 `M.isSubmapOf` m2 && M.fold (\(x1, x2) b -> b && x1 `leq` x2) True (M.intersectionWith (,) m1 m2)++instance PartialOrd v => PartialOrd (IM.IntMap v) where+ im1 `leq` im2 = im1 `IM.isSubmapOf` im2 && IM.fold (\(x1, x2) b -> b && x1 `leq` x2) True (IM.intersectionWith (,) im1 im2) instance (Eq v, Enumerable k) => Eq (k -> v) where f == g = all (\k -> f k == g k) universe
lattices.cabal view
@@ -1,5 +1,5 @@ Name: lattices-Version: 1.1+Version: 1.2 Cabal-Version: >= 1.2 Category: Math Synopsis: Fine-grained library for constructing and manipulating lattices