-
Notifications
You must be signed in to change notification settings - Fork 3
/
herf-time.cabal
88 lines (79 loc) · 2.76 KB
/
herf-time.cabal
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
Name: herf-time
Version: 0.3.1
Author: Scott Murphy <scottmurphy09@gmail.com>
Maintainer: Scott Murphy <scottmurphy09@gmail.com>
License: BSD3
License-File: LICENSE
Synopsis: haskell time manipulation in a 'kerf like' style.
Category: Time, Kerf
Description:
The herf-time package attempts to make the time package's syntax more straightforward for doing interval math and conversion.
It borrows heavily from the syntax of the kerf programming language <https://github.com/kevinlawler/kerf> .
But unlike kerf, there are no promisses of high performance code here.
The performance seems adequate for lots of uses though and manipulating time in the herf library is pretty fun.
.
The @KerfTime@ module is self contained and the only dependency is the time package.
.
Add intervals of varying amounts.
.
> date 2016 01 01 `add` hour 3 `add` week 16 `add` month 3 :: UTCHerfTime
UTCHerfTime 2016-07-22 03:00:00 UTC
.
Subtract intervals as well
.
> date 2016 01 01 `add` hour (-3) `add` week (-16) `add` month (-3) :: UTCHerfTime
UTCHerfTime 2015-06-10 21:00:00 UTC
.
Use the same interval notation for different time representation
.
> dateTime 2016 01 01 01 23 01 `add` (hour 3) `add` (week 16) `add` (month 3) :: UTCHerfTime
UTCHerfTime 2016-07-22 04:23:01 UTC
.
> (reherf $ ( dateTime 2016 01 01 01 01 01 :: HerfZonedTime "CST")) :: HerfZonedTime "PST"
2015-12-31T23:01:01:PST
.
> zt <- getZonedTime
.
> herfShow zt
"2016-01-21T11:29:05:CST"
.
> reherfz zt :: HerfZonedTime "PST"
2016-01-21T09:29:05:PST
.
> reherfz zt :: HerfZonedTime "+0600"
2016-01-21T23:29:05:+0600
.
> reherfz zt :: HerfZonedTime "CST"
2016-01-21T11:29:05:CST
.
> (reherfz zt) `add` month 2 :: HerfZonedTime "CST"
2016-03-21T11:29:05:CST
.
> (reherfz zt) `add` month 2 :: HerfZonedTime "PST"
2016-03-21T09:29:05:PST
.
Cabal-Version: >= 1.10
Build-Type: Simple
Extra-Source-Files: README.md, ChangeLog.md
Library
Default-Language: Haskell2010
HS-Source-Dirs: src
GHC-Options: -Wall
Exposed-Modules: HerfTime
HerfTime.ZonedTime
-- Other-Modules:
Build-Depends: base >= 4 && < 5
, time
Test-Suite doctest
Type: exitcode-stdio-1.0
Default-Language: Haskell2010
Hs-Source-Dirs: src
, test
Ghc-Options: -Wall
Main-Is: Spec.hs
Build-Depends: base
, doctest
, herf-time
Source-Repository head
Type: git
Location: https://github.com/smurphy8/herf-time