thyme-0.4.1: A faster time library
Safe HaskellSafe-Inferred
LanguageHaskell2010

Data.Thyme.Time.Core

Description

This module provides the Thyme typeclass, and instances for converting between Data.Time and Data.Thyme types. It also provides compatibility wrappers for existing code using Data.Time.

Note that we do not provide Num hierarchy instances for DiffTime nor NominalDiffTime here. If you want to use them anyway despite parts of them being ill-defined (e.g. (*) on DiffTime), import Data.Thyme.Time instead.

Synopsis

Documentation

module Data.Thyme

class Thyme time thyme | thyme -> time where Source #

Typeclass for converting between Data.Time and Data.Thyme types.

Methods

thyme :: Iso' time thyme Source #

Convert between Data.Time and Data.Thyme types.

> :set -t
> import qualified Data.Time

> thyme # (fromSeconds' 10 :: DiffTime)
10s
it :: DiffTime

> secondsToDiffTime 10 ^. thyme :: DiffTime
10s
it :: DiffTime

Instances

Instances details
Thyme Day Day Source # 
Instance details

Defined in Data.Thyme.Time.Core

Methods

thyme :: Iso' Day0 Day Source #

Thyme AbsoluteTime AbsoluteTime Source # 
Instance details

Defined in Data.Thyme.Time.Core

Thyme DiffTime DiffTime Source # 
Instance details

Defined in Data.Thyme.Time.Core

Thyme NominalDiffTime NominalDiffTime Source # 
Instance details

Defined in Data.Thyme.Time.Core

Thyme UTCTime UTCTime Source # 
Instance details

Defined in Data.Thyme.Time.Core

Methods

thyme :: Iso' UTCTime0 UTCTime Source #

Thyme UTCTime UTCView Source # 
Instance details

Defined in Data.Thyme.Time.Core

Methods

thyme :: Iso' UTCTime UTCView Source #

Thyme UniversalTime UniversalTime Source # 
Instance details

Defined in Data.Thyme.Time.Core

Thyme LocalTime LocalTime Source # 
Instance details

Defined in Data.Thyme.Time.Core

Thyme TimeOfDay TimeOfDay Source # 
Instance details

Defined in Data.Thyme.Time.Core

Thyme TimeZone TimeZone Source # 
Instance details

Defined in Data.Thyme.Time.Core

Thyme ZonedTime ZonedTime Source # 
Instance details

Defined in Data.Thyme.Time.Core

toThyme :: Thyme time thyme => time -> thyme Source #

Convert a Data.Time type to a Data.Thyme type, if you would rather not use Control.Lens directly.

toThyme = view thyme
toThyme t ≡ t ^. thyme

fromThyme :: Thyme time thyme => thyme -> time Source #

Convert a Data.Thyme type to a Data.Time type, if you would rather not use Control.Lens directly.

fromThyme = review thyme
fromThyme t ≡ thyme # t