Add a type signature

This commit is contained in:
Michael Snoyman 2012-07-13 18:37:42 +03:00
parent c005bc0aec
commit b9d5890567
2 changed files with 2 additions and 0 deletions

View File

@ -278,6 +278,7 @@ timeParser = do
if i < 0 || i >= 24
then fail $ show $ MsgInvalidHour $ pack xy
else return i
minsec :: (Num a, Read a, Ord a) => (Text -> FormMessage) -> Parser a
minsec msg = do
x <- digit
y <- digit <|> fail (show $ msg $ pack [x])

View File

@ -24,6 +24,7 @@ main = hspec $
, ("1:00:01", Right $ TimeOfDay 1 0 1)
, ("1:00:02 AM", Right $ TimeOfDay 1 0 2)
, ("1:00:04 am", Right $ TimeOfDay 1 0 4)
, ("1:00:05 am", Right $ read "01:00:05")
, ("1:00:64 am", Left $ MsgInvalidSecond "64")
, ("1:00:4 am", Left $ MsgInvalidSecond "4")
, ("0:00", Right $ TimeOfDay 0 0 0)