]> gitweb @ CieloNegro.org - time-http.git/blobdiff - Data/Time/Asctime.hs
Rewrote RFC733
[time-http.git] / Data / Time / Asctime.hs
index de9de39d5f3dc0eca98b8af75fad91ed76157346..f8d28ccd80091fb0424c779245aaa6627d50068a 100644 (file)
@@ -2,6 +2,7 @@
     FlexibleInstances
   , MultiParamTypeClasses
   , OverloadedStrings
+  , TemplateHaskell
   , UnicodeSyntax
   #-}
 -- |This module provides functions for ANSI C's asctime() format.
@@ -52,18 +53,10 @@ instance ConvertSuccess LocalTime (Tagged Asctime Ascii) where
     {-# INLINE convertSuccess #-}
     convertSuccess = (A.fromAsciiBuilder <$>) ∘ cs
 
-instance ConvertAttempt LocalTime (Tagged Asctime Ascii) where
-    {-# INLINE convertAttempt #-}
-    convertAttempt = return ∘ cs
-
 instance ConvertSuccess LocalTime (Tagged Asctime AsciiBuilder) where
     {-# INLINE convertSuccess #-}
     convertSuccess = Tagged ∘ toAsciiBuilder
 
-instance ConvertAttempt LocalTime (Tagged Asctime AsciiBuilder) where
-    {-# INLINE convertAttempt #-}
-    convertAttempt = return ∘ cs
-
 instance ConvertAttempt (Tagged Asctime Ascii) LocalTime where
     {-# INLINE convertAttempt #-}
     convertAttempt = parseAttempt' asctime ∘ untag
@@ -109,3 +102,7 @@ toAsciiBuilder localTime
         ⊕ show2 (floor (todSec timeOfDay) ∷ Int)
         ⊕ A.toAsciiBuilder " "
         ⊕ show4 year
+
+deriveAttempts [ ([t| LocalTime |], [t| Tagged Asctime Ascii        |])
+               , ([t| LocalTime |], [t| Tagged Asctime AsciiBuilder |])
+               ]