dirfiles 0.1.0.3 → 0.1.0.4
raw patch · 3 files changed
+9/−5 lines, 3 files
Files
- Data/Library.hs +7/−3
- Data/Library/IRI.hs +1/−1
- dirfiles.cabal +1/−1
Data/Library.hs view
@@ -4,6 +4,7 @@ , ItemId , LibraryItem(..) , Error(..)+, empty , move , copy , delete@@ -18,7 +19,7 @@ where import Data.Text (Text)-import Data.IntSet (IntSet, insert, empty)+import Data.IntSet (IntSet, insert) import qualified Data.IntSet as IS import Data.Sequence (Seq, (|>)) import qualified Data.Sequence as Seq@@ -40,6 +41,9 @@ type ItemId = Int +empty :: Library+empty = Seq.empty+ move :: Library -> ItemId -> ItemId -> UTCTime -> Either Error Library move lib origin destination t = if origin == 0 then Left MovingRoot else do d <- getItem destination lib -- destination@@ -98,7 +102,7 @@ where i = Item (Seq.length lib) (fromText name) (fmap fromText description) creationTime creationTime parent $ - maybe (Left $ Dir empty empty) Right uuiri+ maybe (Left $ Dir IS.empty IS.empty) Right uuiri -- | No bounds checking and doesn't filter deleted items -- returns an exception error when the item is not found@@ -158,7 +162,7 @@ , f1 t, d1 t ] f1 t = Item 1 "f1" (Just "ficheiro 1") t t 0 (Right $ toUUIRI (UUID $ fromWords 1 2 3 4) "http://blah.com/f1.txt")-d1 t = Item 2 "d1" (Just "dir 1") t t 0 (Left (empty, empty))+d1 t = Item 2 "d1" (Just "dir 1") t t 0 (Left (IS.empty, IS.empty)) -} instance ToJSON LibraryItem where
Data/Library/IRI.hs view
@@ -23,7 +23,6 @@ data IRI = Relative Text | Absolute Text deriving(Show)-deriveSafeCopy 0 'base ''IRI -- from Data.SafeCopy instance ToJSON IRI where toJSON = toJSON . fromIRI@@ -65,3 +64,4 @@ dirs (Relative t) = split (== '/') t dirs (Absolute t) = drop 3 $ split (== '/') t +$(deriveSafeCopy 0 'base ''IRI)
dirfiles.cabal view
@@ -2,7 +2,7 @@ -- documentation, see http://haskell.org/cabal/users-guide/ name: dirfiles-version: 0.1.0.3+version: 0.1.0.4 -- synopsis: description: Simple datatype to represent a library with files and folders license: BSD3