packages feed

damnpacket 1.0.2 → 1.1.0

raw patch · 2 files changed

+16/−9 lines, 2 filesPVP ok

version bump matches the API change (PVP)

API changes (from Hackage documentation)

Files

damnpacket.cabal view
@@ -1,5 +1,5 @@ name:                damnpacket-version:             1.0.2+version:             1.1.0 synopsis:            Parsing dAmn messages description:         This module provides a datatype and convenience functions for parsing, manipulating, and rendering deviantART Message Network messages. license:             MIT@@ -32,12 +32,12 @@   ghc-options:      -Wall  test-suite parse-  main-is:             parse.hs-  hs-source-dirs:      test-  default-language:    Haskell2010-  type:                exitcode-stdio-1.0-  build-depends:       base, bytestring, damnpacket, HUnit, hspec, QuickCheck+  main-is:          parse.hs+  hs-source-dirs:   test+  default-language: Haskell2010+  type:             exitcode-stdio-1.0+  build-depends:    base, bytestring, damnpacket, HUnit, hspec, QuickCheck  source-repository head-  location:            https://github.com/pikajude/damnpacket-  type:                git+  location:         https://github.com/pikajude/damnpacket+  type:             git
src/Network/Damn.hs view
@@ -40,6 +40,7 @@ import qualified Data.Attoparsec.ByteString        as A import qualified Data.Attoparsec.ByteString.Char8  as C import           Data.ByteString+import qualified Data.ByteString as B import           Data.Char import           Data.Ix import           Data.Monoid@@ -150,7 +151,13 @@ -- | Convert a 'MessageBody' to some stringlike representation using the -- given 'Formatter'. (See 'Network.Damn.Format.Damn.damnFormat'). bodyWithFormat :: Monoid s => Formatter s -> MessageBody -> s-bodyWithFormat f = foldMap f . toLumps . bodyBytes+bodyWithFormat f = foldMap f . dropColorAbbrs . toLumps . bodyBytes where+    -- these are annoying and nobody needs them+    dropColorAbbrs (Right (Abbr c) : Right C_Abbr : xs)+        | "colors:" `B.isPrefixOf` c = xs+        | otherwise = Right (Abbr c) : dropColorAbbrs (Right C_Abbr : xs)+    dropColorAbbrs (x:xs) = x : dropColorAbbrs xs+    dropColorAbbrs [] = []  messageP :: Parser Message messageP = do