packages feed

codec-mbox 0.1.0.0 → 0.2.0.0

raw patch · 2 files changed

+22/−20 lines, 2 filesdep −fclabelsPVP ok

version bump matches the API change (PVP)

Dependencies removed: fclabels

API changes (from Hackage documentation)

- Codec.Mbox: mboxMsgBody :: MboxMessage s :-> s
+ Codec.Mbox: mboxMsgBody :: Functor f => (a -> f a) -> MboxMessage a -> f (MboxMessage a)
- Codec.Mbox: mboxMsgFile :: MboxMessage s :-> FilePath
+ Codec.Mbox: mboxMsgFile :: Functor f => (FilePath -> f FilePath) -> MboxMessage a -> f (MboxMessage a)
- Codec.Mbox: mboxMsgOffset :: MboxMessage s :-> Int64
+ Codec.Mbox: mboxMsgOffset :: Functor f => (Int64 -> f Int64) -> MboxMessage a -> f (MboxMessage a)
- Codec.Mbox: mboxMsgSender :: MboxMessage s :-> s
+ Codec.Mbox: mboxMsgSender :: Functor f => (a -> f a) -> MboxMessage a -> f (MboxMessage a)
- Codec.Mbox: mboxMsgTime :: MboxMessage s :-> s
+ Codec.Mbox: mboxMsgTime :: Functor f => (a -> f a) -> MboxMessage a -> f (MboxMessage a)

Files

Codec/Mbox.hs view
@@ -1,4 +1,4 @@-{-# LANGUAGE BangPatterns, TypeOperators, TemplateHaskell #-}+{-# LANGUAGE BangPatterns #-} -------------------------------------------------------------------- -- | -- Module    : Codec.Mbox@@ -48,19 +48,18 @@ import Control.Arrow (first,second) import Control.Applicative ((<$>)) import qualified Data.ByteString.Lazy.Char8 as C -- Char8 interface over Lazy ByteString's-import Data.Label import Data.ByteString.Lazy (ByteString) import Data.Int (Int64) import Data.Maybe (listToMaybe) import System.IO import System.IO.Unsafe (unsafeInterleaveIO) -data a :*: b = !a :*: !b+data P a b = !a :*: !b -first' :: (a -> b) -> (a :*: c) -> (b :*: c)+first' :: (a -> b) -> P a c -> P b c first' f !(a :*: c) = f a :*: c {-# INLINE first' #-}-uncurry' :: (a -> b -> c) -> a :*: b -> c+uncurry' :: (a -> b -> c) -> P a b -> c uncurry' f (x :*: y) = f x y {-# INLINE uncurry' #-} @@ -79,22 +78,25 @@                                  , _mboxMsgOffset  :: Int64 }   deriving (Eq, Ord, Show) -$(mkLabelsNoTypes [''MboxMessage])---- | First-class label to message's sender-mboxMsgSender  :: MboxMessage s :-> s+-- | Message's sender lens+mboxMsgSender  :: Functor f => (a -> f a) -> MboxMessage a -> f (MboxMessage a)+mboxMsgSender f (MboxMessage s t b p o) = (\x -> MboxMessage x t b p o) <$> f s --- | First-class label to the date and time of the given message-mboxMsgTime    :: MboxMessage s :-> s+-- | Message's time lens+mboxMsgTime    :: Functor f => (a -> f a) -> MboxMessage a -> f (MboxMessage a)+mboxMsgTime f (MboxMessage s t b p o) = (\x -> MboxMessage s x b p o) <$> f t --- | First-class label to message's raw body-mboxMsgBody    :: MboxMessage s :-> s+-- | Message's body lens+mboxMsgBody    :: Functor f => (a -> f a) -> MboxMessage a -> f (MboxMessage a)+mboxMsgBody f (MboxMessage s t b p o) = (\x -> MboxMessage s t x p o) <$> f b  -- | First-class label to the file path of mbox's message-mboxMsgFile    :: MboxMessage s :-> FilePath+mboxMsgFile    :: Functor f => (FilePath -> f FilePath) -> MboxMessage a -> f (MboxMessage a)+mboxMsgFile f (MboxMessage s t b p o) = (\x -> MboxMessage s t b x o) <$> f p  -- | First-class label to the offset of the given message into the mbox-mboxMsgOffset  :: MboxMessage s :-> Int64+mboxMsgOffset  :: Functor f => (Int64-> f Int64) -> MboxMessage a -> f (MboxMessage a)+mboxMsgOffset f (MboxMessage s t b p o) = (\x -> MboxMessage s t b p x) <$> f o  readYear :: MboxMessage C.ByteString -> C.ByteString -> Int readYear m s =@@ -245,7 +247,7 @@ parseMbox :: ByteString -> Mbox ByteString parseMbox = either error id . safeParseMbox "" 0 -splitMboxMessages :: Int64 -> ByteString -> [Int64 :*: ByteString]+splitMboxMessages :: Int64 -> ByteString -> [P Int64 ByteString] splitMboxMessages !offset !input =   case nextFrom input of     Nothing | C.null input      -> []
codec-mbox.cabal view
@@ -1,6 +1,6 @@ name:            codec-mbox cabal-Version:   >=1.8-version:         0.1.0.0+version:         0.2.0.0 license:         BSD3 license-File:    LICENSE copyright:       (c) Nicolas Pouillard@@ -16,7 +16,7 @@ build-type:      Simple  library-  build-depends:   base (==3.* || ==4.*), bytestring>=0.9, fclabels>=1.0+  build-depends:   base (==3.* || ==4.*), bytestring>=0.9   exposed-modules: Codec.Mbox-  ghc-options:     -Wall-  extensions:      BangPatterns, TypeOperators+  ghc-options:     -Wall -O2+  extensions:      BangPatterns