-- Hoogle documentation, generated by Haddock
-- See Hoogle, http://www.haskell.org/hoogle/


-- | Libary for parsing dates in strings in varied formats.
--   
--   Please see the README on GitHub at
--   <a>https://github.com/ReedOei/fuzzy-dates#readme</a>
@package fuzzy-dates
@version 0.1.1.1

module Data.Dates.Parsing.Internal

-- | Parsers the parser at least once, but no more than n times.
takeN1 :: Stream s m Char => Int -> ParsecT s st m a -> ParsecT s st m [a]

-- | Parse natural number of N digits which is not greater than M
number :: (Stream s m Char, Integral a, Show a) => Int -> a -> ParsecT s st m a
pYear :: Stream s m Char => ParsecT s st m Int
pYearNormal :: Stream s m Char => ParsecT s st m Int
readNum :: (Num a, Stream s m Char) => ParsecT s st m a
yearAbbreviations :: Stream s m Char => ParsecT s st m String
makeAbbr :: String -> [String]
pYearAny :: Stream s m Char => ParsecT s st m Int
monthAssoc :: [(String, Month)]
casings :: String -> [String]

-- | Parse various capitalizations of the given string, but always return
--   the same string on success.
parseAs :: Stream s m Char => [String] -> String -> ParsecT s st m String
pMonthName :: Stream s m Char => ParsecT s st m Month
pMonth :: Stream s m Char => ParsecT s st m Month
pDay :: Stream s m Char => ParsecT s st m Int
uppercase :: String -> String

-- | Case-insensitive version of <a>isPrefixOf</a>
isPrefixOfI :: String -> String -> Bool

-- | Use a data type's Bounded, Enum and Show instances to determine if the
--   given string uniquely matches a constructor. The comparison is
--   case-insensitive and starts from the beginning of the strings (so a
--   partial constructor name can still match if there are enough
--   characters for a unique match)
--   
--   For example:
--   
--   <pre>
--   data Things = Foo | Bar | Baz deriving (Bounded, Enum, Show)
--   
--   -- Right Foo
--   uniqFuzzyMatch "f" :: Either [Things] Things
--   
--   -- Left [Bar, Baz]
--   uniqFuzzyMatch "ba" :: Either [Things] Things
--   </pre>
uniqFuzzyMatch :: (Bounded a, Enum a, Show a) => String -> Either [a] a


-- | Parse strings that aren't so precise
module Data.Dates.Parsing
data Config

-- | Which day of the week to consider the start day
Config :: DateTime -> WeekDay -> Config

-- | <a>Current</a> date/time, to use as base for relative dates
[_now] :: Config -> DateTime
[_startOfWeekDay] :: Config -> WeekDay

-- | Date and Time
data DateTime
DateTime :: Date -> TimeOfDay -> DateTime
[dtDate] :: DateTime -> Date
[dtTime] :: DateTime -> TimeOfDay
data DateInterval
Days :: Int -> DateInterval
Weeks :: Int -> DateInterval
Months :: Int -> DateInterval
Years :: Int -> DateInterval

-- | Represent time types that can be created from other time types.
--   
--   Every conversion happens throught ElapsedP or Elapsed types.
class Timeable t => Time t

-- | convert from a number of elapsed seconds and nanoseconds to another
--   time representation
timeFromElapsedP :: Time t => ElapsedP -> t

-- | convert from a number of elapsed seconds and nanoseconds to another
--   time representation
--   
--   defaults to timeFromElapsedP unless defined explicitely by an
--   instance.
timeFromElapsed :: Time t => Elapsed -> t
defaultConfig :: DateTime -> Config
defaultConfigIO :: IO Config

-- | Parse date/time
parseDate :: Config -> String -> Either ParseError Date

-- | Parse date/time
parseDateTime :: Config -> String -> Either ParseError DateTime
pAbsDateTime :: Stream s m Char => Int -> ParsecT s st m DateTime
pAbsDate :: Stream s m Char => Int -> ParsecT s st m Date

-- | Parsec parser for Date only.
pDate :: Stream s m Char => Config -> ParsecT s st m Date

-- | Parsec parser for DateTime.
pDateTime :: Stream s m Char => Config -> ParsecT s st m DateTime
time :: Stream s m Char => ParsecT s st m TimeOfDay
pDateInterval :: Stream s m Char => ParsecT s st m DateInterval

-- | Weekday as interval from the configure start of the week
weekdayToInterval :: Config -> WeekDay -> DateInterval

-- | Get weekday of given date.
dateWeekDay :: DateTime -> WeekDay
getStartOfThisWeek :: Config -> DateTime
getStartOfNextWeek :: Config -> DateTime
lastDate :: Stream s m Char => Config -> ParsecT s st m DateTime
nextDate :: Stream s m Char => Config -> ParsecT s st m DateTime

-- | Add date interval to DateTime
addInterval :: DateTime -> DateInterval -> DateTime

-- | Negate DateInterval value: Days 3 -&gt; Days (-3).
negateInterval :: DateInterval -> DateInterval

-- | Subtract DateInterval from DateTime.
minusInterval :: DateTime -> DateInterval -> DateTime
dateInFormat :: Stream s m Char => Int -> DateFormat -> ParsecT s st m Date

-- | Same as extractDatesY, but will get the current year from the system,
--   so you don't have to provide it.
extractDates :: String -> IO [Date]

-- | Extract dates from a string, with the first argument being the current
--   year (used for things like "Jan 18").
--   
--   <pre>
--   &gt;&gt;&gt; extractDatesY 2018 "The party will be on 6/9"
--   [Date 2018 June 9]
--   </pre>
extractDatesY :: Int -> String -> [Date]
extractDateTimes :: String -> IO [DateTime]

-- | Extract dates with optional times from a string, with the first
--   argument being the current year (used for things like "Jan 18"). If no
--   time is specified, will return time at midnight.
--   
--   <pre>
--   &gt;&gt;&gt; extractDateTimesY 2018 "The talk starts at 12.09.12 8:00 AM"
--   [DateTime {dtDate = Date {dateYear = 2012, dateMonth = September, dateDay = 12}, dtTime = TimeOfDay {todHour = 8h, todMin = 0m, todSec = 0s, todNSec = 0ns}}]
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; extractDateTimesY 2018 "The party will be on 6/9"
--   [DateTime {dtDate = Date {dateYear = 2018, dateMonth = June, dateDay = 9}, dtTime = TimeOfDay {todHour = 0h, todMin = 0m, todSec = 0s, todNSec = 0ns}}]
--   </pre>
extractDateTimesY :: Int -> String -> [DateTime]
extract :: Stream s m Char => ParsecT s st m a -> ParsecT s st m [a]
instance Data.Data.Data Data.Dates.Parsing.DateInterval
instance GHC.Show.Show Data.Dates.Parsing.DateInterval
instance GHC.Classes.Eq Data.Dates.Parsing.DateInterval
