plailude-0.4.0: plaimi's prelude

Copyright(c) plaimi 2014
LicenseGPL-3
Maintainerplailude@plaimi.net
Safe HaskellNone
LanguageHaskell2010

Plailude

Description

 

Synopsis

Documentation

erretreat :: (MonadError e m, MonadError e n) => m a -> m (n a) Source

retreat the value a of a MonadError m further into the MonadError burrito by injecting it into yet another MonadError n, giving us m (n a). If there's an error, it is rethrown inside n.

retreat :: (Monad m, Monad n) => m a -> m (n a) Source

Retreat the value a of a Monad m further into the Monad burrito by injecting it into yet another Monad n, giving us m (n a).

(.:) :: (c -> d) -> (a -> b -> c) -> a -> b -> d Source

Compose two functions where the second function takes two values and delivers its result as a single value to the first function.

This is equivalent to: (f .: g) x y = f (g x y).

(.:.) :: (d -> e) -> (a -> b -> c -> d) -> a -> b -> c -> e Source

Compose two functions where the second function takes three values and delivers its result as a single value to the first function.

This is equivalent to: (f .:. g) x y z = f (g x y z).

showL8 :: Show a => a -> ByteString Source

showL8 converts a showable value to a ByteString using show.

newtype Hour a Source

A Hour type, for type safety of time units.

Constructors

MkHour Int

Make an Hour, an Int deriving TimeUnit.

Instances

newtype Minute a Source

A Minute type, for type safety of time units.

Constructors

MkMinute Int

Make a Minute, an Int deriving TimeUnit.

Instances

newtype Second a Source

A Second type, for type safety of time units.

Constructors

MkSecond Int

Make a Second, an Int deriving TimeUnit.

Instances

newtype Year a Source

A Year type, for type safety of time units.

Constructors

MkYear Integer

Make a Year, an Integer deriving TimeUnit.

Instances

newtype Month a Source

A Month type, for type safety of time units.

Constructors

MkMonth Int

Make a Month, an Int deriving TimeUnit.

Instances

newtype Day a Source

A Day type, for type safety of time units.

Constructors

MkDay Int

Make a Day, an Int deriving TimeUnit.

Instances

class TimeUnit t where Source

TimeUnits are units of time with a value that's an instance of Num. The class is used to get type safety of time units, and a function for getting "out" the value (analogues to fromJust for Maybe) for every type of Num, for free.

Methods

timeVal :: Num n => t -> n Source

Get out the value in a TimeUnit. The value's type is polymorphic and constrained to Num.

asSeconds :: Hour h -> Minute m -> Second s -> Second t Source

asSeconds take some TimeUnits and convert them to Seconds.

fromGregorian :: Year y -> Month mo -> Day d -> Day Source

fromGregorian is a wrapper for Data.Time.Calendar.fromGregorian, which lets us pass our Year - Month - Day structures. It calls Data.Time.Calendar.fromGregorian with the appropriate types, and returns a Data.Time.Calendar.Day.