X-Git-Url: http://git.cielonegro.org/gitweb.cgi?p=time-http.git;a=blobdiff_plain;f=Data%2FTime%2FFormat%2FRFC822.hs;fp=Data%2FTime%2FRFC822.hs;h=0d8fcacdacae3b7db0546fcc2498677fbb68803a;hp=152d99290f57e89915e72eaf80efd36e72c22e1e;hb=2064aacf48e193924b6ffe18a50853d233c16b98;hpb=901a3635d37e25a2d4c2e1562c32c68c410fbdd3 diff --git a/Data/Time/RFC822.hs b/Data/Time/Format/RFC822.hs similarity index 64% rename from Data/Time/RFC822.hs rename to Data/Time/Format/RFC822.hs index 152d992..0d8fcac 100644 --- a/Data/Time/RFC822.hs +++ b/Data/Time/Format/RFC822.hs @@ -2,7 +2,7 @@ UnicodeSyntax #-} -- |This module provides functions to parse and format RFC 822 date --- and time formats. +-- and time strings (). -- -- The syntax is as follows: -- @@ -30,32 +30,17 @@ -- > | "N" ; +1 -- > | "Y" ; +12 -- > | ("+" | "-") 4DIGIT ; Local diff: HHMM -module Data.Time.RFC822 - ( -- * Formatting - toAscii - , toAsciiBuilder - - -- * Parsing - , fromAscii +module Data.Time.Format.RFC822 + ( RFC822 + , rfc822 , rfc822DateAndTime ) where -import Data.Ascii (Ascii) -import qualified Data.Ascii as A -import qualified Data.Attoparsec.Char8 as P -import Data.Time -import Data.Time.RFC822.Internal -import Prelude.Unicode - --- |Convert a 'ZonedTime' to RFC 822 date and time string. -toAscii ∷ ZonedTime → Ascii -toAscii = A.fromAsciiBuilder ∘ toAsciiBuilder +import Data.Proxy +import Data.Time.Format.RFC822.Internal --- |Parse an RFC 822 date and time string. When the string can't be --- parsed, it returns @'Left' err@. -fromAscii ∷ Ascii → Either String ZonedTime -fromAscii = P.parseOnly p ∘ A.toByteString - where - p = do zt ← rfc822DateAndTime - P.endOfInput - return zt +-- |The proxy for conversions between RFC 822 date and time strings +-- and 'ZonedTime'. +rfc822 ∷ Proxy RFC822 +{-# INLINE CONLIKE rfc822 #-} +rfc822 = Proxy