duckling-0.1.4.0: A Haskell library for parsing text into structured data.

Safe HaskellNone
LanguageHaskell2010

Duckling.Time.Types

Synopsis

Documentation

data Form Source #

Constructors

DayOfWeek 
TimeOfDay 

Fields

Month 

Fields

PartOfDay 

Instances

Eq Form Source # 

Methods

(==) :: Form -> Form -> Bool #

(/=) :: Form -> Form -> Bool #

Ord Form Source # 

Methods

compare :: Form -> Form -> Ordering #

(<) :: Form -> Form -> Bool #

(<=) :: Form -> Form -> Bool #

(>) :: Form -> Form -> Bool #

(>=) :: Form -> Form -> Bool #

max :: Form -> Form -> Form #

min :: Form -> Form -> Form #

Show Form Source # 

Methods

showsPrec :: Int -> Form -> ShowS #

show :: Form -> String #

showList :: [Form] -> ShowS #

Generic Form Source # 

Associated Types

type Rep Form :: * -> * #

Methods

from :: Form -> Rep Form x #

to :: Rep Form x -> Form #

Hashable Form Source # 

Methods

hashWithSalt :: Int -> Form -> Int #

hash :: Form -> Int #

NFData Form Source # 

Methods

rnf :: Form -> () #

type Rep Form Source # 
type Rep Form = D1 * (MetaData "Form" "Duckling.Time.Types" "duckling-0.1.4.0-CnjCIBQpbItDuGIirz0Gvr" False) ((:+:) * ((:+:) * (C1 * (MetaCons "DayOfWeek" PrefixI False) (U1 *)) (C1 * (MetaCons "TimeOfDay" PrefixI True) ((:*:) * (S1 * (MetaSel (Just Symbol "hours") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 * (Maybe Int))) (S1 * (MetaSel (Just Symbol "is12H") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 * Bool))))) ((:+:) * (C1 * (MetaCons "Month" PrefixI True) (S1 * (MetaSel (Just Symbol "month") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 * Int))) (C1 * (MetaCons "PartOfDay" PrefixI False) (U1 *))))

data IntervalDirection Source #

Constructors

Before 
After 

type SeriesPredicate = TimeObject -> TimeContext -> ([TimeObject], [TimeObject]) Source #

Return a tuple of (past, future) elements

data AMPM Source #

Constructors

AM 
PM 

Instances

Eq AMPM Source # 

Methods

(==) :: AMPM -> AMPM -> Bool #

(/=) :: AMPM -> AMPM -> Bool #

Show AMPM Source # 

Methods

showsPrec :: Int -> AMPM -> ShowS #

show :: AMPM -> String #

showList :: [AMPM] -> ShowS #

newtype NoShow a Source #

Constructors

NoShow a 

Instances

Show (NoShow a) Source # 

Methods

showsPrec :: Int -> NoShow a -> ShowS #

show :: NoShow a -> String #

showList :: [NoShow a] -> ShowS #

runYearPredicate :: Int -> SeriesPredicate Source #

Converts 2-digits to a year between 1950 and 2050

timeSeqMap :: Bool -> (TimeObject -> TimeContext -> Maybe TimeObject) -> Predicate -> SeriesPredicate Source #

Applies f to each interval yielded by g. | Intervals including "now" are in the future.

pad :: Int -> Int -> Text Source #

Zero-pad x to reach length n.

timezoneOffset :: TimeZone -> Text Source #

Return the timezone offset portion of the RFC3339 format, e.g. "-02:00".

toRFC3339 :: ZonedTime -> Text Source #

Return a RFC3339 formatted time, e.g. "2013-02-12T04:30:00.000-02:00". | Backward-compatible with Duckling: fraction of second is milli and padded.

timePlusEnd :: TimeObject -> Grain -> Integer -> TimeObject Source #

Shifts the whole interval by n units of theGrain Returned interval has the same length as the input one

data TimeIntervalType Source #

Closed if the interval between A and B should include B Open if the interval should end right before B

Constructors

Open 
Closed 

timeIntersect :: TimeObject -> TimeObject -> Maybe TimeObject Source #

Intersection between two TimeObject. The resulting grain and end fields are the smallest. Prefers intervals when the range is equal.