Skip to content

Commit ffdd94f

Browse files
authored
Merge pull request #71 from purescript/compiler/0.12
Updates for PureScript 0.12
2 parents 0374573 + e125b49 commit ffdd94f

File tree

15 files changed

+125
-215
lines changed

15 files changed

+125
-215
lines changed

LICENSE

Lines changed: 22 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,26 @@
1-
The MIT License (MIT)
1+
Copyright 2018 PureScript
22

3-
Copyright (c) 2014 PureScript
3+
Redistribution and use in source and binary forms, with or without modification,
4+
are permitted provided that the following conditions are met:
45

5-
Permission is hereby granted, free of charge, to any person obtaining a copy of
6-
this software and associated documentation files (the "Software"), to deal in
7-
the Software without restriction, including without limitation the rights to
8-
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
9-
the Software, and to permit persons to whom the Software is furnished to do so,
10-
subject to the following conditions:
6+
1. Redistributions of source code must retain the above copyright notice, this
7+
list of conditions and the following disclaimer.
118

12-
The above copyright notice and this permission notice shall be included in all
13-
copies or substantial portions of the Software.
9+
2. Redistributions in binary form must reproduce the above copyright notice,
10+
this list of conditions and the following disclaimer in the documentation and/or
11+
other materials provided with the distribution.
1412

15-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
17-
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
18-
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
19-
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
20-
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
13+
3. Neither the name of the copyright holder nor the names of its contributors
14+
may be used to endorse or promote products derived from this software without
15+
specific prior written permission.
16+
17+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
18+
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
19+
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
20+
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
21+
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
22+
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
23+
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
24+
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25+
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
26+
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

bower.json

Lines changed: 21 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
{
22
"name": "purescript-datetime",
33
"homepage": "https://github.com/purescript/purescript-datetime",
4-
"description": "PureScript library for date and time values",
5-
"license": "MIT",
4+
"license": "BSD-3-Clause",
65
"repository": {
76
"type": "git",
87
"url": "git://github.com/purescript/purescript-datetime.git"
@@ -16,17 +15,27 @@
1615
"package.json"
1716
],
1817
"dependencies": {
19-
"purescript-enums": "^3.1.0",
20-
"purescript-functions": "^3.0.0",
21-
"purescript-generics": "^4.0.0",
22-
"purescript-integers": "^3.0.0",
23-
"purescript-foldable-traversable": "^3.0.0",
24-
"purescript-maps": "^3.0.0",
25-
"purescript-math": "^2.0.0"
18+
"purescript-bifunctors": "^4.0.0",
19+
"purescript-control": "^4.0.0",
20+
"purescript-either": "^4.0.0",
21+
"purescript-enums": "^4.0.0",
22+
"purescript-foldable-traversable": "^4.0.0",
23+
"purescript-functions": "^4.0.0",
24+
"purescript-gen": "^2.0.0",
25+
"purescript-integers": "^4.0.0",
26+
"purescript-lists": "^5.0.0",
27+
"purescript-math": "^2.1.1",
28+
"purescript-maybe": "^4.0.0",
29+
"purescript-newtype": "^3.0.0",
30+
"purescript-ordered-collections": "^1.0.0",
31+
"purescript-partial": "^2.0.0",
32+
"purescript-prelude": "^4.0.0",
33+
"purescript-tuples": "^5.0.0"
2634
},
2735
"devDependencies": {
28-
"purescript-assert": "^3.0.0",
29-
"purescript-console": "^3.0.0",
30-
"purescript-strings": "^3.0.0"
36+
"purescript-assert": "^4.0.0",
37+
"purescript-console": "^4.0.0",
38+
"purescript-strings": "^4.0.0",
39+
"purescript-proxy": "^3.0.0"
3140
}
3241
}

package.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,12 @@
33
"scripts": {
44
"clean": "rimraf output && rimraf .pulp-cache",
55
"build": "eslint src && pulp build -- --censor-lib --strict",
6-
"test": "pulp test"
6+
"test": "pulp test --check-main-type Effect.Effect"
77
},
88
"devDependencies": {
9-
"eslint": "^3.17.1",
10-
"pulp": "^11.0.x",
11-
"purescript-psa": "^0.5.x",
12-
"rimraf": "^2.6.1"
9+
"eslint": "^4.19.1",
10+
"pulp": "^12.2.0",
11+
"purescript-psa": "^0.6.0",
12+
"rimraf": "^2.6.2"
1313
}
1414
}

src/Data/Date.purs

Lines changed: 15 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,8 @@ import Prelude
1717
import Data.Date.Component (Day, Month(..), Weekday(..), Year)
1818
import Data.Enum (toEnum, fromEnum)
1919
import Data.Function.Uncurried (Fn3, runFn3, Fn4, runFn4, Fn6, runFn6)
20-
import Data.Generic (class Generic)
2120
import Data.Maybe (Maybe(..), fromJust)
22-
import Data.Time.Duration (class Duration, toDuration, Milliseconds)
23-
21+
import Data.Time.Duration (class Duration, Milliseconds, toDuration)
2422
import Partial.Unsafe (unsafePartial)
2523

2624
-- | A date value in the Gregorian calendar.
@@ -45,7 +43,6 @@ exactDate y m d =
4543

4644
derive instance eqDate :: Eq Date
4745
derive instance ordDate :: Ord Date
48-
derive instance genericDate :: Generic Date
4946

5047
instance boundedDate :: Bounded Date where
5148
bottom = Date bottom bottom bottom
@@ -78,29 +75,30 @@ diff :: forall d. Duration d => Date -> Date -> d
7875
diff (Date y1 m1 d1) (Date y2 m2 d2) =
7976
toDuration $ runFn6 calcDiff y1 (fromEnum m1) d1 y2 (fromEnum m2) d2
8077

81-
-- | Is this year a leap year according to the proleptic Gregorian calendar?
78+
-- | Checks whether a year is a leap year according to the proleptic Gregorian
79+
-- | calendar.
8280
isLeapYear :: Year -> Boolean
8381
isLeapYear y = (mod y' 4 == 0) && ((mod y' 400 == 0) || not (mod y' 100 == 0))
8482
where
8583
y' = fromEnum y
8684

87-
-- | Get the final day of a month and year, accounting for leap years
85+
-- | Get the final day of a month and year, accounting for leap years.
8886
lastDayOfMonth :: Year -> Month -> Day
8987
lastDayOfMonth y m = case m of
90-
January -> unsafeDay 31
88+
January -> unsafeDay 31
9189
February
9290
| isLeapYear y -> unsafeDay 29
93-
| otherwise -> unsafeDay 28
94-
March -> unsafeDay 31
95-
April -> unsafeDay 30
96-
May -> unsafeDay 31
97-
June -> unsafeDay 30
98-
July -> unsafeDay 31
99-
August -> unsafeDay 31
91+
| otherwise -> unsafeDay 28
92+
March -> unsafeDay 31
93+
April -> unsafeDay 30
94+
May -> unsafeDay 31
95+
June -> unsafeDay 30
96+
July -> unsafeDay 31
97+
August -> unsafeDay 31
10098
September -> unsafeDay 30
101-
October -> unsafeDay 31
102-
November -> unsafeDay 30
103-
December -> unsafeDay 31
99+
October -> unsafeDay 31
100+
November -> unsafeDay 30
101+
December -> unsafeDay 31
104102
where
105103
unsafeDay = unsafePartial fromJust <<< toEnum
106104

src/Data/Date/Component.purs

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ module Data.Date.Component
88
import Prelude
99

1010
import Data.Enum (class Enum, class BoundedEnum, toEnum, fromEnum, Cardinality(..))
11-
import Data.Generic (class Generic)
1211
import Data.Maybe (Maybe(..))
1312

1413
-- | A year component for a date.
@@ -20,7 +19,6 @@ newtype Year = Year Int
2019

2120
derive newtype instance eqYear :: Eq Year
2221
derive newtype instance ordYear :: Ord Year
23-
derive instance genericYear :: Generic Year
2422

2523
-- Note: these seemingly arbitrary bounds come from relying on JS for date
2624
-- manipulations, as it only supports date ±100,000,000 days of the Unix epoch.
@@ -61,7 +59,6 @@ data Month
6159

6260
derive instance eqMonth :: Eq Month
6361
derive instance ordMonth :: Ord Month
64-
derive instance genericMonth :: Generic Month
6562

6663
instance boundedMonth :: Bounded Month where
6764
bottom = January
@@ -124,7 +121,6 @@ newtype Day = Day Int
124121

125122
derive newtype instance eqDay :: Eq Day
126123
derive newtype instance ordDay :: Ord Day
127-
derive instance genericDay :: Generic Day
128124

129125
instance boundedDay :: Bounded Day where
130126
bottom = Day 1
@@ -156,7 +152,6 @@ data Weekday
156152

157153
derive instance eqWeekday :: Eq Weekday
158154
derive instance ordWeekday :: Ord Weekday
159-
derive instance genericWeekday :: Generic Weekday
160155

161156
instance boundedWeekday :: Bounded Weekday where
162157
bottom = Monday

src/Data/DateTime.purs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ import Prelude
1717
import Data.Date (Date, Day, Month(..), Weekday(..), Year, canonicalDate, day, exactDate, month, weekday, year)
1818
import Data.Enum (toEnum, fromEnum)
1919
import Data.Function.Uncurried (Fn2, runFn2)
20-
import Data.Generic (class Generic)
2120
import Data.Time (Hour, Millisecond, Minute, Second, Time(..), hour, setHour, millisecond, setMillisecond, minute, setMinute, second, setSecond)
2221
import Data.Time.Duration (class Duration, fromDuration, toDuration, Milliseconds)
2322
import Data.Maybe (Maybe(..))
@@ -27,7 +26,6 @@ data DateTime = DateTime Date Time
2726

2827
derive instance eqDateTime :: Eq DateTime
2928
derive instance ordDateTime :: Ord DateTime
30-
derive instance genericDateTime :: Generic DateTime
3129

3230
instance boundedDateTime :: Bounded DateTime where
3331
bottom = DateTime bottom bottom

src/Data/DateTime/Instant.purs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ import Prelude
1212
import Data.DateTime (Millisecond, Second, Minute, Hour, Day, Year, DateTime(..), Date, Time(..), canonicalDate, millisecond, second, minute, hour, day, month, year)
1313
import Data.Enum (fromEnum, toEnum)
1414
import Data.Function.Uncurried (Fn7, runFn7)
15-
import Data.Generic (class Generic)
1615
import Data.Maybe (Maybe(..), fromJust)
1716
import Data.Time.Duration (Milliseconds(..))
1817

@@ -27,7 +26,6 @@ newtype Instant = Instant Milliseconds
2726

2827
derive newtype instance eqDateTime :: Eq Instant
2928
derive newtype instance ordDateTime :: Ord Instant
30-
derive instance genericDateTime :: Generic Instant
3129

3230
instance boundedInstant :: Bounded Instant where
3331
bottom = Instant (Milliseconds (-8639977881600000.0))

src/Data/DateTime/Locale.purs

Lines changed: 0 additions & 74 deletions
This file was deleted.

src/Data/Interval.purs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
module Data.Interval
22
( Interval(..)
33
, RecurringInterval(..)
4-
, module DurationExports
4+
, module Exports
55
) where
66

77
import Prelude
@@ -11,7 +11,7 @@ import Data.Bifoldable (class Bifoldable, bifoldl, bifoldr, bifoldrDefault, bifo
1111
import Data.Bifunctor (class Bifunctor, bimap)
1212
import Data.Bitraversable (class Bitraversable, bitraverse, bisequenceDefault)
1313
import Data.Foldable (class Foldable, foldl, foldr, foldrDefault, foldMapDefaultL)
14-
import Data.Interval.Duration as DurationExports
14+
import Data.Interval.Duration (Duration(..), DurationComponent(..), day, hour, millisecond, minute, month, second, week, year) as Exports
1515
import Data.Maybe (Maybe)
1616
import Data.Traversable (class Traversable, traverse, sequenceDefault)
1717

@@ -70,7 +70,7 @@ instance showInterval :: (Show d, Show a) => Show (Interval d a) where
7070
show (DurationOnly d) = "(DurationOnly " <> show d <> ")"
7171

7272
instance functorInterval :: Functor (Interval d) where
73-
map = bimap id
73+
map = bimap identity
7474

7575
instance bifunctorInterval :: Bifunctor Interval where
7676
bimap _ f (StartEnd x y) = StartEnd (f x) (f y)

src/Data/Interval/Duration.purs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ module Data.Interval.Duration
1414
import Prelude
1515

1616
import Data.Map as Map
17-
import Data.Monoid (class Monoid, mempty)
1817
import Data.Newtype (class Newtype)
1918

2019
newtype Duration = Duration (Map.Map DurationComponent Number)

0 commit comments

Comments
 (0)