]> gitweb @ CieloNegro.org - time-http.git/commitdiff
Delete Data.Time.Asctime.Internal
authorPHO <pho@cielonegro.org>
Sun, 4 Dec 2011 08:32:19 +0000 (17:32 +0900)
committerPHO <pho@cielonegro.org>
Sun, 4 Dec 2011 08:32:19 +0000 (17:32 +0900)
Ditz-issue: 0a3272772c73cf31486eb2b6691fa38232d3c4c5

Data/Time/Asctime.hs
Data/Time/Asctime/Internal.hs [deleted file]
Data/Time/HTTP/Internal.hs
bugs/issue-0a3272772c73cf31486eb2b6691fa38232d3c4c5.yaml
time-http.cabal

index 0814e451f9f0f82e37f849da656740adb0e09103..39d9961a8f68b0cd2c62641c464e964d13a02d8d 100644 (file)
@@ -1,5 +1,6 @@
 {-# LANGUAGE
 {-# LANGUAGE
-    UnicodeSyntax
+    OverloadedStrings
+  , UnicodeSyntax
   #-}
 -- |This module provides functions for ANSI C's asctime() format.
 --
   #-}
 -- |This module provides functions for ANSI C's asctime() format.
 --
@@ -31,11 +32,13 @@ module Data.Time.Asctime
     , asctime
     )
     where
     , asctime
     )
     where
-import Data.Ascii (Ascii)
+import Data.Ascii (Ascii, AsciiBuilder)
 import qualified Data.Ascii as A
 import qualified Data.Ascii as A
-import qualified Data.Attoparsec.Char8 as P
+import Data.Attoparsec.Char8
+import Data.Monoid.Unicode
 import Data.Time
 import Data.Time
-import Data.Time.Asctime.Internal
+import Data.Time.Calendar.WeekDate
+import Data.Time.HTTP.Common
 import Prelude.Unicode
 
 -- |Convert a 'LocalTime' to ANSI C's @asctime()@ string.
 import Prelude.Unicode
 
 -- |Convert a 'LocalTime' to ANSI C's @asctime()@ string.
@@ -45,8 +48,51 @@ toAscii = A.fromAsciiBuilder ∘ toAsciiBuilder
 -- |Parse an ANSI C's @asctime()@ string. When the string can't be
 -- parsed, it returns @'Left' err@.
 fromAscii ∷ Ascii → Either String LocalTime
 -- |Parse an ANSI C's @asctime()@ string. When the string can't be
 -- parsed, it returns @'Left' err@.
 fromAscii ∷ Ascii → Either String LocalTime
-fromAscii = P.parseOnly p ∘ A.toByteString
+fromAscii = parseOnly p ∘ A.toByteString
     where
       p = do zt ← asctime
     where
       p = do zt ← asctime
-             P.endOfInput
+             endOfInput
              return zt
              return zt
+
+-- |Parse an ANSI C's @asctime()@ string.
+asctime ∷ Parser LocalTime
+asctime = do weekDay ← shortWeekDayNameP
+             _       ← char ' '
+             month   ← shortMonthNameP
+             _       ← char ' '
+             day     ← read2'
+             _       ← char ' '
+             hour    ← read2
+             _       ← char ':'
+             minute  ← read2
+             _       ← char ':'
+             second  ← read2
+             _       ← char ' '
+             year    ← read4
+
+             gregDay ← assertGregorianDateIsGood year month day
+             _       ← assertWeekDayIsGood weekDay gregDay
+             tod     ← assertTimeOfDayIsGood hour minute second
+
+             return (LocalTime gregDay tod)
+
+-- |Convert a 'LocalTime' to ANSI C's @asctime()@ string.
+toAsciiBuilder ∷ LocalTime → AsciiBuilder
+toAsciiBuilder localTime
+    = let (year, month, day) = toGregorian (localDay localTime)
+          (_, _, week)       = toWeekDate  (localDay localTime)
+          timeOfDay          = localTimeOfDay localTime
+      in
+        shortWeekDayName week
+        ⊕ A.toAsciiBuilder " "
+        ⊕ shortMonthName month
+        ⊕ A.toAsciiBuilder " "
+        ⊕ show2' day
+        ⊕ A.toAsciiBuilder " "
+        ⊕ show2 (todHour timeOfDay)
+        ⊕ A.toAsciiBuilder ":"
+        ⊕ show2 (todMin timeOfDay)
+        ⊕ A.toAsciiBuilder ":"
+        ⊕ show2 (floor (todSec timeOfDay) ∷ Int)
+        ⊕ A.toAsciiBuilder " "
+        ⊕ show4 year
diff --git a/Data/Time/Asctime/Internal.hs b/Data/Time/Asctime/Internal.hs
deleted file mode 100644 (file)
index 1681fc0..0000000
+++ /dev/null
@@ -1,61 +0,0 @@
-{-# LANGUAGE
-    OverloadedStrings
-  , UnicodeSyntax
-  #-}
--- |Internal functions for "Data.Time.Asctime".
-module Data.Time.Asctime.Internal
-    ( asctime
-    , toAsciiBuilder
-    )
-    where
-import Data.Ascii (AsciiBuilder)
-import qualified Data.Ascii as A
-import Data.Attoparsec.Char8
-import Data.Monoid.Unicode
-import Data.Time
-import Data.Time.Calendar.WeekDate
-import Data.Time.HTTP.Common
-
--- |Parse an ANSI C's @asctime()@ string.
-asctime ∷ Parser LocalTime
-asctime = do weekDay ← shortWeekDayNameP
-             _       ← char ' '
-             month   ← shortMonthNameP
-             _       ← char ' '
-             day     ← read2'
-             _       ← char ' '
-             hour    ← read2
-             _       ← char ':'
-             minute  ← read2
-             _       ← char ':'
-             second  ← read2
-             _       ← char ' '
-             year    ← read4
-
-             gregDay ← assertGregorianDateIsGood year month day
-             _       ← assertWeekDayIsGood weekDay gregDay
-             tod     ← assertTimeOfDayIsGood hour minute second
-
-             return (LocalTime gregDay tod)
-
--- |Convert a 'LocalTime' to ANSI C's @asctime()@ string.
-toAsciiBuilder ∷ LocalTime → AsciiBuilder
-toAsciiBuilder localTime
-    = let (year, month, day) = toGregorian (localDay localTime)
-          (_, _, week)       = toWeekDate  (localDay localTime)
-          timeOfDay          = localTimeOfDay localTime
-      in
-        shortWeekDayName week
-        ⊕ A.toAsciiBuilder " "
-        ⊕ shortMonthName month
-        ⊕ A.toAsciiBuilder " "
-        ⊕ show2' day
-        ⊕ A.toAsciiBuilder " "
-        ⊕ show2 (todHour timeOfDay)
-        ⊕ A.toAsciiBuilder ":"
-        ⊕ show2 (todMin timeOfDay)
-        ⊕ A.toAsciiBuilder ":"
-        ⊕ show2 (floor (todSec timeOfDay) ∷ Int)
-        ⊕ A.toAsciiBuilder " "
-        ⊕ show4 year
-
index e94567076420449fb0c22e27b7fd8bb4f5aef3ad..aada8bd01b087258115995b276c5c54ef8ac32ed 100644 (file)
@@ -13,7 +13,7 @@ import Data.Attoparsec.Char8
 import Data.Time
 import qualified Data.Time.RFC1123.Internal as RFC1123
 import qualified Data.Time.RFC733.Internal  as RFC733
 import Data.Time
 import qualified Data.Time.RFC1123.Internal as RFC1123
 import qualified Data.Time.RFC733.Internal  as RFC733
-import qualified Data.Time.Asctime.Internal as Asctime
+import qualified Data.Time.Asctime          as Asctime
 import Prelude.Unicode
 
 -- |Parse a date and time string in any formats allowed by HTTP\/1.1
 import Prelude.Unicode
 
 -- |Parse a date and time string in any formats allowed by HTTP\/1.1
index 8792f580fffb4988939b9cf749772a0a902389db..f7be4fa380b85808f2146f99b2457a69a639812d 100644 (file)
@@ -5,7 +5,7 @@ type: :task
 component: time-http
 release: time-http-0.3
 reporter: PHO <pho@cielonegro.org>
 component: time-http
 release: time-http-0.3
 reporter: PHO <pho@cielonegro.org>
-status: :unstarted
+status: :in_progress
 disposition: 
 creation_time: 2011-12-01 01:58:17.790699 Z
 references: []
 disposition: 
 creation_time: 2011-12-01 01:58:17.790699 Z
 references: []
@@ -16,4 +16,8 @@ log_events:
   - PHO <pho@cielonegro.org>
   - created
   - ""
   - PHO <pho@cielonegro.org>
   - created
   - ""
+- - 2011-12-01 23:15:25.041203 Z
+  - PHO <pho@cielonegro.org>
+  - changed status from unstarted to in_progress
+  - ""
 git_branch: 
 git_branch: 
index d8c1c2a13df6239b7c7bd7d9998fffd560a96665..eae4ffaff88b8f460465bf32bac6f20af9659cd1 100644 (file)
@@ -33,7 +33,6 @@ Library
         Data.Time.RFC822
 
     Other-modules:
         Data.Time.RFC822
 
     Other-modules:
-        Data.Time.Asctime.Internal
         Data.Time.HTTP.Common
         Data.Time.HTTP.Internal
         Data.Time.RFC1123.Internal
         Data.Time.HTTP.Common
         Data.Time.HTTP.Internal
         Data.Time.RFC1123.Internal
@@ -47,6 +46,8 @@ Library
         blaze-textual        == 0.2.*,
         base                 == 4.*,
         base-unicode-symbols == 0.2.*,
         blaze-textual        == 0.2.*,
         base                 == 4.*,
         base-unicode-symbols == 0.2.*,
+        convertible-text     == 0.3.*,
+        tagged               == 0.2.*,
         time                 == 1.2.*
 
     Default-Language:
         time                 == 1.2.*
 
     Default-Language:
@@ -67,6 +68,8 @@ Test-Suite test-time-http
         blaze-textual        == 0.2.*,
         base                 == 4.*,
         base-unicode-symbols == 0.2.*,
         blaze-textual        == 0.2.*,
         base                 == 4.*,
         base-unicode-symbols == 0.2.*,
+        convertible-text     == 0.3.*,
+        tagged               == 0.2.*,
         time                 == 1.2.*
     GHC-Options:
         -Wall -fno-warn-orphans
         time                 == 1.2.*
     GHC-Options:
         -Wall -fno-warn-orphans