hoodle-core 0.13 → 0.13.0
raw patch · 2 files changed
+15/−14 lines, 2 filesdep ~Diff
Dependency ranges changed: Diff
Files
- hoodle-core.cabal +2/−2
- src/Hoodle/ModelAction/Select.hs +13/−12
hoodle-core.cabal view
@@ -1,5 +1,5 @@ Name: hoodle-core-Version: 0.13 +Version: 0.13.0 Synopsis: Core library for hoodle Description: Hoodle is a pen notetaking program written in haskell. hoodle-core is the core library written in haskell and @@ -55,7 +55,7 @@ process >= 1.1, configurator >= 0.2, time >= 1.2, - Diff >= 0.1 && < 0.2,+ Diff >= 0.3, dyre >= 0.8.11, cereal >= 0.3.5, base64-bytestring >= 0.1,
src/Hoodle/ModelAction/Select.hs view
@@ -16,8 +16,9 @@ -- from other package import Control.Lens (view,set)-import Data.Algorithm.Diff+import Data.Algorithm.Diff as A import Data.Foldable (foldl')+import qualified Data.Function as F (on) import qualified Data.IntMap as M import qualified Data.Map as Map import Data.Monoid@@ -234,24 +235,24 @@ CmpBBox s1 == CmpBBox s2 = getBBox s1 == getBBox s2 -- |-isSame :: DI -> Bool -isSame B = True +isSame :: Diff a -> Bool +isSame (A.Both _ _) = True isSame _ = False -- |-separateFS :: [(DI,a)] -> ([a],[a])+separateFS :: [Diff a] -> ([a],[a]) separateFS = foldr f ([],[]) - where f (F,x) (fs,ss) = (x:fs,ss)- f (S,x) (fs,ss) = (fs,x:ss)- f (B,_x) (fs,ss) = (fs,ss)+ where f (A.First x) (fs,ss) = (x:fs,ss)+ f (A.Second x) (fs,ss) = (fs,x:ss)+ f (A.Both _ _) (fs,ss) = (fs,ss) -- |-getDiffBBox :: (GetBBoxable a) => [a] -> [a] -> [(DI,a)]+getDiffBBox :: (GetBBoxable a) => [a] -> [a] -> [Diff a] getDiffBBox lst1 lst2 = - let nlst1 = fmap CmpBBox lst1 - nlst2 = fmap CmpBBox lst2 - diffresult = getDiff nlst1 nlst2 - in map (\(x,y)->(x,unCmpBBox y)) diffresult+ let -- nlst1 = fmap CmpBBox lst1 + -- nlst2 = fmap CmpBBox lst2 + diffresult = getDiffBy ((==) `F.on` CmpBBox) lst1 lst2 + in diffresult -- map (\(x,y)->(x,unCmpBBox y)) diffresult -- | checkIfHandleGrasped :: BBox -> (Double,Double) -> Maybe Handle