parseInput :: String -> Maybe DateNumOrDate
parseInput inp = case parse datenumOrDate "" inp of
                    Left error -> Nothing
                    Right parsed -> Just parsed

{- Parsers
 -
 - Grammar for valid inputs (along with parser types):
 -
 - datenumOrDate = datenum | date                        :: DateNumOrDate
 - datenum       = -? digit+ eof                         :: Integer
 - date          = mdy | ymd                             :: Date (mdy before ymd, in order to make 01-01-01 be mdy)
 - mdy           = month sep day   sep year eof          :: Date
 - ymd           = year  sep month sep day  eof          :: Date
 - month         = shortint                              :: Int
 - day           = shortint                              :: Int
 - year          = digit digit digit digit | digit digit :: Integer (Integer because that's what fromGregorian requires)
 - shortint      = digit digit | digit                   :: Int
 - sep           = [ /-]+                                :: ()
 -}
parseInput :: String -> Maybe DateNumOrDate
parseInput inp = case parse datenumOrDate "" inp of
                    Left error -> Nothing
                    Right parsed -> Just parsed

{- Parsers
 -
 - Grammar for valid inputs (along with parser types):
 -
 - datenumOrDate = datenum | date                        :: DateNumOrDate
 - datenum       = -? digit+ eof                         :: Integer
 - date          = mdy | ymd                             :: Date (mdy before ymd, in order to make 01-01-01 be mdy)
 - mdy           = month sep day   sep year eof          :: Date
 - ymd           = year  sep month sep day  eof          :: Date
 - month         = shortint                              :: Int
 - day           = shortint                              :: Int
 - year          = digit digit digit digit | digit digit :: Integer (Integer because that's what fromGregorian requires)
 - shortint      = digit digit | digit                   :: Int
 - sep           = [ /-]+                                :: ()
 -}
parseInput inp = case parse datenumOrDate "" inp of
                    Left error -> Nothing
                    Right parsed -> Just parsed

{- Parsers
 -
 - Grammar for valid inputs (along with parser types):
 -
 - datenumOrDate = datenum | date                        :: DateNumOrDate
 - datenum       = -? digit+ eof                         :: Integer
 - date          = mdy | ymd                             :: Date (mdy before ymd, in order to make 01-01-01 be mdy)
 - mdy           = month sep day   sep year eof          :: Date
 - ymd           = year  sep month sep day  eof          :: Date
 - month         = shortint                              :: Int
 - day           = shortint                              :: Int
 - year          = digit digit digit digit | digit digit :: Integer (Integer because that's what fromGregorian requires)
 - shortint      = digit digit | digit                   :: Int
 - sep           = [ /-]+                                :: ()
 -}