months-0.1: Month, YearMonth, Quarter, YearQuarter types

Safe HaskellTrustworthy
LanguageHaskell2010

Data.Time.Quarter

Contents

Description

Quarter data type.

Synopsis

Types

data Quarter Source #

We explicitly enumerate quarter names. Using an Int is unsafe.

Constructors

Q1 
Q2 
Q3 
Q4 
Instances
Bounded Quarter Source # 
Instance details

Defined in Data.Time.Quarter

Enum Quarter Source # 
Instance details

Defined in Data.Time.Quarter

Eq Quarter Source # 
Instance details

Defined in Data.Time.Quarter

Methods

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

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

Ord Quarter Source # 
Instance details

Defined in Data.Time.Quarter

Read Quarter Source # 
Instance details

Defined in Data.Time.Quarter

Show Quarter Source # 
Instance details

Defined in Data.Time.Quarter

Generic Quarter Source # 
Instance details

Defined in Data.Time.Quarter

Associated Types

type Rep Quarter :: Type -> Type #

Methods

from :: Quarter -> Rep Quarter x #

to :: Rep Quarter x -> Quarter #

Arbitrary Quarter Source # 
Instance details

Defined in Data.Time.Quarter

Hashable Quarter Source # 
Instance details

Defined in Data.Time.Quarter

Methods

hashWithSalt :: Int -> Quarter -> Int #

hash :: Quarter -> Int #

NFData Quarter Source # 
Instance details

Defined in Data.Time.Quarter

Methods

rnf :: Quarter -> () #

type Rep Quarter Source # 
Instance details

Defined in Data.Time.Quarter

type Rep Quarter = D1 (MetaData "Quarter" "Data.Time.Quarter" "months-0.1-8UF2elrWYufCYn2Iw3nBtN" False) ((C1 (MetaCons "Q1" PrefixI False) (U1 :: Type -> Type) :+: C1 (MetaCons "Q2" PrefixI False) (U1 :: Type -> Type)) :+: (C1 (MetaCons "Q3" PrefixI False) (U1 :: Type -> Type) :+: C1 (MetaCons "Q4" PrefixI False) (U1 :: Type -> Type)))

data YearQuarter Source #

A quarter in Julian/Gregorian calendar.

Constructors

YearQuarter 
Instances
Enum YearQuarter Source # 
Instance details

Defined in Data.Time.Quarter

Eq YearQuarter Source # 
Instance details

Defined in Data.Time.Quarter

Ord YearQuarter Source # 
Instance details

Defined in Data.Time.Quarter

Show YearQuarter Source #

Doesn't print field names.

Instance details

Defined in Data.Time.Quarter

Generic YearQuarter Source # 
Instance details

Defined in Data.Time.Quarter

Associated Types

type Rep YearQuarter :: Type -> Type #

Arbitrary YearQuarter Source # 
Instance details

Defined in Data.Time.Quarter

Hashable YearQuarter Source # 
Instance details

Defined in Data.Time.Quarter

ToJSON YearQuarter Source #

TODO: use builder if we really want speed

Instance details

Defined in Data.Time.Quarter

ToJSONKey YearQuarter Source # 
Instance details

Defined in Data.Time.Quarter

FromJSON YearQuarter Source # 
Instance details

Defined in Data.Time.Quarter

FromJSONKey YearQuarter Source # 
Instance details

Defined in Data.Time.Quarter

FromField YearQuarter Source # 
Instance details

Defined in Data.Time.Quarter

ToField YearQuarter Source # 
Instance details

Defined in Data.Time.Quarter

Methods

toField :: YearQuarter -> Field #

NFData YearQuarter Source # 
Instance details

Defined in Data.Time.Quarter

Methods

rnf :: YearQuarter -> () #

ToHttpApiData YearQuarter Source # 
Instance details

Defined in Data.Time.Quarter

FromHttpApiData YearQuarter Source # 
Instance details

Defined in Data.Time.Quarter

ToHtml YearQuarter Source # 
Instance details

Defined in Data.Time.Quarter

Methods

toHtml :: Monad m => YearQuarter -> HtmlT m () #

toHtmlRaw :: Monad m => YearQuarter -> HtmlT m () #

ToSchema YearQuarter Source # 
Instance details

Defined in Data.Time.Quarter

ToParamSchema YearQuarter Source #

Format "quarter" corresponds to yyyy-mm format.

Instance details

Defined in Data.Time.Quarter

type Rep YearQuarter Source # 
Instance details

Defined in Data.Time.Quarter

type Rep YearQuarter = D1 (MetaData "YearQuarter" "Data.Time.Quarter" "months-0.1-8UF2elrWYufCYn2Iw3nBtN" False) (C1 (MetaCons "YearQuarter" PrefixI True) (S1 (MetaSel (Just "quarterYear") NoSourceUnpackedness SourceStrict DecidedStrict) (Rec0 Integer) :*: S1 (MetaSel (Just "quarterName") NoSourceUnpackedness SourceStrict DecidedStrict) (Rec0 Quarter)))

Conversion with Day

dayToYearQuarter :: Day -> YearQuarter Source #

Extract Quarter from Day

>>> dayToYearQuarter (read "2017-02-03")
YearQuarter 2017 Q1

firstDayOfYearQuarter :: YearQuarter -> Day Source #

First day of the quarter.

>>> firstDayOfYearQuarter $ YearQuarter 2017 Q3
2017-07-01

lastDayOfYearQuarter :: YearQuarter -> Day Source #

Last day of the quarter

>>> lastDayOfYearQuarter $ YearQuarter 2017 Q1
2017-03-31
>>> lastDayOfYearQuarter $ YearQuarter 2016 Q2
2016-06-30

yearQuarterInterval :: YearQuarter -> Interval Day Source #

Day interval of month

>>> yearQuarterInterval $ YearQuarter 2017 Q2
2017-04-01 ... 2017-06-30

Conversions with Text