packages feed

bbdb 0.6.1 → 0.8

raw patch · 3 files changed

+135/−76 lines, 3 filesPVP ok

version bump matches the API change (PVP)

API changes (from Hackage documentation)

Files

bbdb.cabal view
@@ -1,5 +1,5 @@ Name:                bbdb-Version:             0.6.1+Version:             0.8 Synopsis:            Ability to read, write, and modify BBDB files Description:         BBDB (http://savannah.nongnu.org/projects/bbdb/) is a                      contact management utility that can be used with@@ -24,22 +24,31 @@                      README.md                      test/sampleData.txt                      -Cabal-version:       >=1.8+Cabal-version:       >=1.10  Library   Exposed-modules:     Database.BBDB   hs-source-dirs:      src+  ghc-options:         -Wall+  default-language:    Haskell2010+  default-extensions:  FlexibleInstances,+                       MultiParamTypeClasses,+                       OverloadedStrings   Build-depends:-     base >= 3 && <= 5,-     parsec >=3+                base >= 3 && <= 5,+                parsec >= 3+ Test-Suite bbdb-tests   Type:                exitcode-stdio-1.0   Main-is:             Spec.hs   hs-source-dirs:      src,test   Other-modules:       Database.BBDB,                        BBDBSpec+  default-language:    Haskell2010+  default-extensions:  FlexibleInstances,+                       MultiParamTypeClasses,+                       OverloadedStrings   Build-depends:-    base >= 3 && <= 5,-    hspec,-    parsec >= 3-+                base >= 3 && <= 5,+                hspec,+                parsec >= 3
changelog.md view
@@ -1,15 +1,23 @@ Changes for Database/BBDB ========================= +from 0.7 -> 0.8+---------------+Changed back from Foundation to Prelude to prevent breakage.++from 0.6 -> 0.7+---------------+Changed over to Foundation rather than Prelude.+ from 0.5 -> 0.6-The new BBDB version (BBDB3) uses file format 9 now.  Three fields were-added: a hash field, a creation date field, and a modification time-field.  Theses used to be present in the notes field.+---------------+The new BBDB version (BBDB3) uses file format 9 now.  Three fields+were added: a hash field, a creation date field, and a modification+time field.  Theses used to be present in the notes field.   from 0.4 -> 0.5 ---------------- The BBDB file format changed.  The current version of the format is 7.  Once field, called *Affixes* was added, and now the extension in a US phone field is required.
src/Database/BBDB.hs view
@@ -131,7 +131,6 @@ import Text.Parsec hiding ((<|>)) import Control.Applicative hiding (many) import Data.Maybe-import Data.List  doubleQuoteChar :: Char doubleQuoteChar = '"'@@ -278,11 +277,11 @@  phoneParser :: Parser Phone phoneParser = do-      char '[' +      _ <- char '['        phoneType <- quotedString       spaces       n <- singlePhone phoneType-      char ']' +      _ <- char ']'        return n   where      singlePhone phoneType = do@@ -299,23 +298,15 @@   singleAddress :: Parser Address-singleAddress = do-    char '['-    location <- quotedString-    space-    streets <- stringsOrNil-    space-    city <- stringOrNil-    space-    state <- stringOrNil-    space-    zip <- stringOrNil-    space-    country <- stringOrNil-    char ']'-    return $ Address location streets city state zip country--+singleAddress = +  char '[' *>+  (Address <$>+  quotedString <* space <*> +  stringsOrNil <* space <*> +  stringOrNil  <* space <*> +  stringOrNil  <* space <*> +  stringOrNil  <* space <*> +  stringOrNil) <* char ']'  addressesParser :: Parser (Maybe [Address]) addressesParser = @@ -339,36 +330,24 @@    <|> Just <$> betweenParens (Note <$> sepBy alist space)  bbdbEntry :: Parser BBDB              -bbdbEntry = do-  char '['-  firstName   <- stringOrNil-  space-  lastName    <- stringOrNil-  space-  affix       <- stringsOrNil-  space-  aka         <- stringsOrNil-  space-  company     <- stringsOrNil-  space-  phoneS      <- phonesParser-  space-  addresseS   <- addressesParser-  space-  net         <- stringsOrNil-  space-  noteS       <- notesParser-  space-  hash        <- quotedString-  space-  creation    <- quotedString-  space-  modifcation <- quotedString-  space-  string "nil"-  char ']'-  return $ BBDB firstName lastName affix aka company phoneS addresseS-    net noteS hash creation modifcation+bbdbEntry =+  char '[' *>+  (BBDB <$>+  stringOrNil      <* space <*> +  stringOrNil      <* space <*> +  stringsOrNil     <* space <*> +  stringsOrNil     <* space <*> +  stringsOrNil     <* space <*>+  phonesParser     <* space <*>+  addressesParser  <* space <*>+  stringsOrNil     <* space <*>+  notesParser      <* space <*>+  quotedString     <* space <*>+  quotedString     <* space <*>+  quotedString)+  <* space+  <* string "nil"+  <* char ']'   -- | The Parser for a BBDB file, as it is written on disk.  If you@@ -403,6 +382,11 @@ surroundWith :: a -> a -> [a] -> [a] surroundWith before after str = before : str ++ [after] +surroundWithQuotes, surroundWithBrackets, surroundWithParens :: String -> String+surroundWithQuotes   = surroundWith '"' '"'+surroundWithBrackets = surroundWith '[' ']'+surroundWithParens   = surroundWith '(' ')'+ -- | convert a Haskell string to a string that Lisp likes escapeLisp :: String -> String escapeLisp [] = []@@ -431,27 +415,27 @@  instance LispAble (Maybe String) where   asLisp   Nothing = "nil"-  asLisp   (Just x) = surroundWith '"' '"' . escapeLisp $ x+  asLisp   (Just x) = surroundWithQuotes . escapeLisp $ x  instance LispAble (Maybe [String]) where   asLisp   Nothing = "nil"-  asLisp   (Just x) = surroundWith '(' ')' . unwords .-                        map (surroundWith '"' '"' . asLisp) $ x+  asLisp   (Just x) = surroundWithParens . unwords .+                        map (surroundWithQuotes . asLisp) $ x  instance LispAble Phone where   asLisp (USStyle loc numbers) =-    surroundWith '[' ']' $ surroundWith '"' '"' loc ++ " " ++ +    surroundWithBrackets $ surroundWithQuotes loc ++ " " ++      unwords numbers-  asLisp (InternationalStyle location numbers) =  -    surroundWith '[' ']' $ surroundWith '"' '"' location ++ " " ++ -    surroundWith '"' '"' numbers+  asLisp (InternationalStyle loc numbers) =  +    surroundWithBrackets $ surroundWithQuotes loc ++ " " ++ +    surroundWithQuotes numbers  instance LispAble (Maybe [Phone]) where   asLisp   Nothing = "nil"-  asLisp   (Just x) = surroundWith '(' ')' . unwords . map asLisp $ x+  asLisp   (Just x) = surroundWithParens . unwords . map asLisp $ x  instance LispAble Address where-  asLisp x = surroundWith '[' ']' $ unwords +  asLisp x = surroundWithBrackets $ unwords      [asLisp $ Just (location x),      asLisp (streets x),      asLisp (city x),@@ -461,24 +445,24 @@  instance LispAble (Maybe [Address]) where   asLisp   Nothing = "nil"-  asLisp   (Just x) = surroundWith '(' ')' . unwords .+  asLisp   (Just x) = surroundWithParens . unwords .                         map asLisp $ x  instance LispAble Alist where-  asLisp x = surroundWith '(' ')' $+  asLisp x = surroundWithParens $     key x ++ " . " ++ asLisp (Just (value x))  instance LispAble Note where-  asLisp (Note x)  = surroundWith '(' ')' . unwords .+  asLisp (Note x)  = surroundWithParens . unwords .                       map asLisp $ x    instance LispAble (Maybe Note) where   asLisp   Nothing = "nil"-  asLisp   (Just x) = surroundWith '(' ')' . unwords . +  asLisp   (Just x) = surroundWithParens . unwords .                          map asLisp $ unnote x                          instance LispAble BBDB where-  asLisp x = surroundWith '[' ']' $ unwords +  asLisp x = surroundWithBrackets $ unwords     [asLisp (firstName x),     asLisp (lastName x),     asLisp (affix x),@@ -590,3 +574,61 @@     g (BBDBEntry x) = f x        +{-+usPhone :: Phone+usPhone = USStyle "home" ["+1", "775", "624", "9011"]+itPhone :: Phone+itPhone = InternationalStyle "work" "+52 (376) 765-3181"+ad1 :: Address+ad1 = Address "home" (Just ["Via Alta #6", "Gaviotas #10"])+                     (Just "Chapala")+                     (Just "Jalisco")+                     (Just "45900")+                     (Just "Mexico")+notes1 :: Note+notes1 = (Note [("notes", "Always split aces and eights"),+               ("birthday", "6/15")])+b1 :: BBDB+b1 = BBDB+     (Just "Henry")+     (Just "Laxen")+     Nothing+     Nothing+     (Just ["Elegant Solutions"])+     (Just [usPhone, itPhone])+     (Just [ad1])+     Nothing+     (Just notes1)+     "hash"+     "creation"+     "modification"+     +usPhone :: Phone+usPhone = USStyle "home" ["+1", "775", "624", "9011"]+itPhone :: Phone+itPhone = InternationalStyle "work" "+52 (376) 765-3181"+ad1 :: Address+ad1 = Address "home" (Just ["Via Alta #6", "Gaviotas #10"])+                     (Just "Chapala")+                     (Just "Jalisco")+                     (Just "45900")+                     (Just "Mexico")+notes1 :: Note+notes1 = (Note [("notes", "Always split aces and eights"),+               ("birthday", "6/15")])+b1 :: BBDB+b1 = BBDB+     (Just "Henry")+     (Just "Laxen")+     Nothing+     Nothing+     (Just ["Elegant Solutions"])+     (Just [usPhone, itPhone])+     (Just [ad1])+     Nothing+     (Just notes1)     "hash"+     "creation"+     "modification"+     ++-}