[commit: packages/time] master, wip/travis: Haddock for parseTime and friends. (0f2e21b)
git at git.haskell.org
git at git.haskell.org
Sat May 7 06:45:35 UTC 2016
Repository : ssh://git@git.haskell.org/time
On branches: master,wip/travis
Link : http://git.haskell.org/packages/time.git/commitdiff/0f2e21b7e9a01b5deea2ece7173b91d45a145c30
>---------------------------------------------------------------
commit 0f2e21b7e9a01b5deea2ece7173b91d45a145c30
Author: bjorn <bjorn at bringert.net>
Date: Tue Oct 16 13:19:31 2007 -0700
Haddock for parseTime and friends.
darcs-hash:20071016201931-6cdb2-3cfa3dd21381bb0fd52398f717d5ba9ad4eaa7b2
>---------------------------------------------------------------
0f2e21b7e9a01b5deea2ece7173b91d45a145c30
Data/Time/Format/Parse.hs | 17 +++++++++++------
1 file changed, 11 insertions(+), 6 deletions(-)
diff --git a/Data/Time/Format/Parse.hs b/Data/Time/Format/Parse.hs
index 7e4c319..c4a258d 100644
--- a/Data/Time/Format/Parse.hs
+++ b/Data/Time/Format/Parse.hs
@@ -36,8 +36,15 @@ class ParseTime t where
-- corresponding part of the input.
-> t
--- | Parse a time value given a format string. Supports the same %-codes as
--- 'formatTime'.
+-- | Parses a time value given a format string. Supports the same %-codes as
+-- 'formatTime'. Leading and trailing whitespace is accepted.
+-- Some variations in the input are accepted:
+--
+-- [@%z@] accepts any of @-HHMM@ or @-HH:MM at .
+--
+-- [@%Z@] accepts any string of upper case letters, or any
+-- of the formats accepted by @%z at .
+--
parseTime :: ParseTime t =>
TimeLocale -- ^ Time locale.
-> String -- ^ Format string.
@@ -49,8 +56,7 @@ parseTime l fmt s = case readsTime l fmt s of
_ -> Nothing
-- | Parse a time value given a format string. Fails if the input could
--- not be parsed using the given format. Supports the same %-codes as
--- 'formatTime'.
+-- not be parsed using the given format. See 'parseTime' for details.
readTime :: ParseTime t =>
TimeLocale -- ^ Time locale.
-> String -- ^ Format string.
@@ -61,8 +67,7 @@ readTime l fmt s = case readsTime l fmt s of
[(_,x)] -> error $ "readTime: junk at end of " ++ show x
_ -> error $ "readsTime: bad input " ++ show s
--- | Parse a time value given a format string. Supports the same %-codes as
--- 'formatTime'.
+-- | Parse a time value given a format string. See 'parseTime' for details.
readsTime :: ParseTime t =>
TimeLocale -- ^ Time locale.
-> String -- ^ Format string
More information about the ghc-commits
mailing list