git.iko.soy/typeable/postgresql-simple
on master help sign in
Rename the Time.Parser module to Time.Internal.Parser
78e898bLeon P Smith
postgresql-simple.cabal+1−1
@@ -49,7 +49,7 @@ Library
49 Database.PostgreSQL.Simple.Compat
49 Database.PostgreSQL.Simple.Compat
50 Database.PostgreSQL.Simple.HStore.Implementation
50 Database.PostgreSQL.Simple.HStore.Implementation
51 Database.PostgreSQL.Simple.Time.Implementation
51 Database.PostgreSQL.Simple.Time.Implementation
52− Database.PostgreSQL.Simple.Time.Parser
52+ Database.PostgreSQL.Simple.Time.Internal.Parser
53 Database.PostgreSQL.Simple.TypeInfo.Types
53 Database.PostgreSQL.Simple.TypeInfo.Types
54
54
55 Build-depends:
55 Build-depends:
src/Database/PostgreSQL/Simple/Time/Implementation.hs+5−3
@@ -28,7 +28,7 @@ import Database.PostgreSQL.Simple.Compat ((<>))
28import Data.Monoid(Monoid(..))
28import Data.Monoid(Monoid(..))
29import Data.Fixed (Pico)
29import Data.Fixed (Pico)
30import Unsafe.Coerce
30import Unsafe.Coerce
31−import qualified Database.PostgreSQL.Simple.Time.Parser as TP
31+import qualified Database.PostgreSQL.Simple.Time.Internal.Parser as TP
32import Database.PostgreSQL.Simple.Compat (fromPico)
32import Database.PostgreSQL.Simple.Compat (fromPico)
33
33
34data Unbounded a
34data Unbounded a
@@ -130,6 +130,7 @@ getUTCTime = TP.utcTime
130getUTCTimestamp :: A.Parser UTCTimestamp
130getUTCTimestamp :: A.Parser UTCTimestamp
131getUTCTimestamp = getUnbounded getUTCTime
131getUTCTimestamp = getUnbounded getUTCTime
132
132
133+{--
133toNum :: Num n => B.ByteString -> n
134toNum :: Num n => B.ByteString -> n
134toNum = toNum_ 0
135toNum = toNum_ 0
135{-# INLINE toNum #-}
136{-# INLINE toNum #-}
@@ -149,6 +150,7 @@ digits msg = do
149 then return $! (10 * digit (c2w x) + digit (c2w y))
150 then return $! (10 * digit (c2w x) + digit (c2w y))
150 else fail (msg <> " is not 2 digits")
151 else fail (msg <> " is not 2 digits")
151{-# INLINE digits #-}
152{-# INLINE digits #-}
153+--}
152
154
153dayToBuilder :: Day -> Builder
155dayToBuilder :: Day -> Builder
154dayToBuilder (toGregorian -> (y,m,d)) = do
156dayToBuilder (toGregorian -> (y,m,d)) = do
@@ -205,8 +207,8 @@ nominalDiffTimeToBuilder xyz
205 | otherwise = sign <> integerDec x <> char8 '.' <> showD6 y
207 | otherwise = sign <> integerDec x <> char8 '.' <> showD6 y
206 where
208 where
207 sign = if xyz >= 0 then mempty else char8 '-'
209 sign = if xyz >= 0 then mempty else char8 '-'
208− -- A kludge to work around the fact that Data.Fixed isn't very fast and
210+ -- A kludge to work around the fact that Data.Fixed isn't very fast and
209− -- NominalDiffTime doesn't give the MkNominalDiffTime constructor.
211+ -- NominalDiffTime doesn't give the MkNominalDiffTime constructor.
210 (x,yz) = ((unsafeCoerce (abs xyz) :: Integer) + 500000) `quotRem` 1000000000000
212 (x,yz) = ((unsafeCoerce (abs xyz) :: Integer) + 500000) `quotRem` 1000000000000
211 (fromIntegral -> y, _z) = yz `quotRem` 1000000
213 (fromIntegral -> y, _z) = yz `quotRem` 1000000
212
214
src/Database/PostgreSQL/Simple/Time/Parser.hs → src/Database/PostgreSQL/Simple/Time/Internal/Parser.hsrenamed+2−3
@@ -1,17 +1,16 @@
1{-# LANGUAGE BangPatterns, ScopedTypeVariables #-}
1{-# LANGUAGE BangPatterns, ScopedTypeVariables #-}
2
2
3-- |
3-- |
4−-- Module: Database.PostgreSQL.Simple.Time.Parser
4+-- Module: Database.PostgreSQL.Simple.Time.Internal.Parser
5-- Copyright: (c) 2012-2015 Leon P Smith
5-- Copyright: (c) 2012-2015 Leon P Smith
6-- (c) 2015 Bryan O'Sullivan
6-- (c) 2015 Bryan O'Sullivan
7-- License: BSD3
7-- License: BSD3
8-- Maintainer: Leon P Smith <leon@melding-monads.com>
8-- Maintainer: Leon P Smith <leon@melding-monads.com>
9-- Stability: experimental
9-- Stability: experimental
10−-- Portability: portable
11--
10--
12-- Parsers for parsing dates and times.
11-- Parsers for parsing dates and times.
13
12
14−module Database.PostgreSQL.Simple.Time.Parser
13+module Database.PostgreSQL.Simple.Time.Internal.Parser
15 (
14 (
16 day
15 day
17 , localTime
16 , localTime