Skip to content
This repository was archived by the owner on Jun 15, 2023. It is now read-only.

Commit d0b1573

Browse files
committed
Update for GH actions, PS 0.14
1 parent 54a2cdd commit d0b1573

File tree

21 files changed

+151
-131
lines changed

21 files changed

+151
-131
lines changed

.github/workflows/ci.yml

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
name: CI
2+
3+
on:
4+
- push
5+
- pull_request
6+
7+
jobs:
8+
build:
9+
runs-on: ubuntu-latest
10+
steps:
11+
- uses: actions/checkout@v2
12+
13+
- uses: purescript-contrib/setup-purescript@main
14+
15+
- uses: actions/setup-node@v1
16+
with:
17+
node-version: "12"
18+
19+
- name: Install dependencies
20+
run: |
21+
npm install -g bower
22+
npm install
23+
bower install --production
24+
25+
- name: Build source
26+
run: npm run-script build
27+
28+
- name: Run tests
29+
run: |
30+
bower install
31+
npm run-script test --if-present

.gitignore

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
/example/example.js
2-
/output/
1+
/.*
2+
!/.gitignore
3+
!/.github
34
/bower_components/
45
/node_modules/
5-
npm-debug.log*
6-
.psc-ide-port
6+
/output/
77
package-lock.json

.travis.yml

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

bower.json

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"license": "Apache-2.0",
44
"repository": {
55
"type": "git",
6-
"url": "git://github.com/slamdata/purescript-halogen-datepicker.git"
6+
"url": "https://github.com/slamdata/purescript-halogen-datepicker.git"
77
},
88
"authors": [
99
"Irakli Safareli <[email protected]>"
@@ -20,15 +20,14 @@
2020
"example"
2121
],
2222
"dependencies": {
23-
"purescript-enums": "^4.0.0",
24-
"purescript-formatters": "^4.0.0",
25-
"purescript-datetime": "^4.1.0",
26-
"purescript-halogen": "^5.0.0-rc.1",
27-
"purescript-halogen-css": "garyb/purescript-halogen-css#halogen-5-bump",
28-
"purescript-generics-rep": "^6.1.0",
29-
"purescript-validation": "^4.0.0",
30-
"purescript-profunctor": "^4.0.0",
31-
"purescript-numbers": "^6.0.0",
32-
"purescript-these": "^4.0.0"
23+
"purescript-enums": "^5.0.0",
24+
"purescript-formatters": "^5.0.0",
25+
"purescript-datetime": "^5.0.2",
26+
"purescript-halogen": "^6.1.1",
27+
"purescript-halogen-css": "^9.0.0",
28+
"purescript-validation": "^5.0.0",
29+
"purescript-profunctor": "^5.0.0",
30+
"purescript-numbers": "^8.0.0",
31+
"purescript-these": "^5.0.0"
3332
}
3433
}

example/src/Main.purs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -81,11 +81,11 @@ type Slots =
8181
, interval Interval.Slot IntervalIdx
8282
)
8383

84-
_time = SProxy SProxy "time"
85-
_date = SProxy SProxy "date"
86-
_dateTime = SProxy SProxy "dateTime"
87-
_duration = SProxy SProxy "duration"
88-
_interval = SProxy SProxy "interval"
84+
_time = Proxy Proxy "time"
85+
_date = Proxy Proxy "date"
86+
_dateTime = Proxy Proxy "dateTime"
87+
_duration = Proxy Proxy "duration"
88+
_interval = Proxy Proxy "interval"
8989

9090
type HTML m = H.ComponentHTML Action Slots m
9191
type DSL m = H.HalogenM State Action Slots Void m
@@ -101,7 +101,7 @@ example
101101
f m
102102
. MonadError Ex.Error m
103103
Applicative m
104-
H.Component HH.HTML f Unit Void m
104+
H.Component f Unit Void m
105105
example =
106106
H.mkComponent
107107
{ initialState: const initialState
@@ -274,7 +274,7 @@ example =
274274
type ExampleConfig fmtInput input fmt query out m =
275275
{ mkFormat fmtInput StrOr fmt
276276
, unformat fmt String StrOr input
277-
, picker fmt H.Component HH.HTML query Unit out m
277+
, picker fmt H.Component query Unit out m
278278
, handler Int out Action
279279
, setter Int Maybe input Action
280280
}

src/Halogen/DatePicker/Component/Date.purs

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,11 @@ import Data.Either (Either(..))
99
import Data.Enum (class BoundedEnum, fromEnum, toEnum, upFromIncluding)
1010
import Data.Foldable (for_)
1111
import Data.Generic.Rep (class Generic)
12-
import Data.Generic.Rep.Show (genericShow)
1312
import Data.Maybe (Maybe(..), maybe)
1413
import Data.Newtype (unwrap)
1514
import Data.Profunctor.Join (Join(..))
1615
import Data.Profunctor.Star (Star(..))
17-
import Data.Symbol (SProxy(..))
16+
import Data.Show.Generic (genericShow)
1817
import Data.Traversable (for)
1918
import Effect.Exception as Ex
2019
import Halogen as H
@@ -28,6 +27,7 @@ import Halogen.Datepicker.Internal.Num as Num
2827
import Halogen.Datepicker.Internal.Range (Range, bottomTop)
2928
import Halogen.Datepicker.Internal.Utils (componentProps, foldSteps, handlePickerQuery, mustBeMounted, pickerProps, transitionState')
3029
import Halogen.HTML as HH
30+
import Type.Proxy (Proxy(..))
3131

3232
type State = PickerValue DateError Date
3333

@@ -47,8 +47,8 @@ type Slots =
4747
, choice Choice.Slot (Maybe Int) F.Command
4848
)
4949

50-
_num = SProxy SProxy "num"
51-
_choice = SProxy SProxy "choice"
50+
_num = Proxy Proxy "num"
51+
_choice = Proxy Proxy "choice"
5252

5353
type Slot = H.Slot Query Message
5454

@@ -58,15 +58,15 @@ type DSL = H.HalogenM State Action Slots Message
5858
picker
5959
m
6060
. MonadError Ex.Error m
61-
F.Format H.Component HH.HTML Query Unit Message m
61+
F.Format H.Component Query Unit Message m
6262
picker = pickerWithConfig defaultConfig
6363

6464
pickerWithConfig
6565
m
6666
. MonadError Ex.Error m
6767
Config
6868
F.Format
69-
H.Component HH.HTML Query Unit Message m
69+
H.Component Query Unit Message m
7070
pickerWithConfig config format =
7171
H.mkComponent
7272
{ initialState: const Nothing
@@ -126,12 +126,12 @@ buildDate format = do
126126
where
127127
mkBuildStep F.Command DSL m BuildStep
128128
mkBuildStep = commandCata
129-
{ text: \cmd → pure $ Just mempty
129+
{ text: \_ → pure $ Just mempty
130130
, enum: \cmd → do
131-
num ← queryNum cmd $ H.request GetValue
131+
num ← queryNum cmd $ H.mkRequest GetValue
132132
pure $ num <#> \n → Join $ Star $ \t → F.toSetter cmd n t
133133
, choice: \cmd → do
134-
num ← queryChoice cmd $ H.request GetValue
134+
num ← queryChoice cmd $ H.mkRequest GetValue
135135
pure $ num <#> \n → Join $ Star $ \t → F.toSetter cmd n t
136136
}
137137
runStep BuildStep Maybe (Maybe Date)
@@ -145,34 +145,34 @@ propagateChange
145145
State
146146
DSL m Unit
147147
propagateChange format date = for_ (unwrap format) $ commandCata
148-
{ text: \cmd → pure unit
148+
{ text: \_ → pure unit
149149
, enum: \cmd → do
150150
let val = value date >>= F.toGetter cmd
151-
queryNum cmd $ H.request (SetValue val)
151+
queryNum cmd $ H.mkRequest (SetValue val)
152152
, choice: \cmd → do
153153
let val = value date >>= F.toGetter cmd
154-
res ← queryChoice cmd $ H.request (SetValue val)
154+
res ← queryChoice cmd $ H.mkRequest (SetValue val)
155155
Choice.valueMustBeInValues res
156156
}
157157

158158
commandCata
159159
a
160-
. { text F.Command a
161-
, enum F.Command a
160+
. { text F.Command a
161+
, enum F.Command a
162162
, choice F.Command a
163163
}
164164
F.Command
165165
a
166166
commandCata p cmd = case cmd of
167-
F.Placeholder str → p.text cmd
168-
F.YearFull → p.enum cmd
169-
F.YearTwoDigits → p.enum cmd
170-
F.YearAbsolute → p.enum cmd
171-
F.MonthFull → p.choice cmd
172-
F.MonthShort → p.choice cmd
173-
F.MonthTwoDigits → p.enum cmd
167+
F.Placeholder _ → p.text cmd
168+
F.YearFull → p.enum cmd
169+
F.YearTwoDigits → p.enum cmd
170+
F.YearAbsolute → p.enum cmd
171+
F.MonthFull → p.choice cmd
172+
F.MonthShort → p.choice cmd
173+
F.MonthTwoDigits → p.enum cmd
174174
F.DayOfMonthTwoDigits → p.enum cmd
175-
F.DayOfMonth → p.enum cmd
175+
F.DayOfMonth → p.enum cmd
176176

177177
queryChoice
178178
m

src/Halogen/DatePicker/Component/DateTime.purs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ import Data.Monoid.Additive (Additive(..))
1616
import Data.Newtype (unwrap)
1717
import Data.Profunctor.Join (Join(..))
1818
import Data.Profunctor.Star (Star(..))
19-
import Data.Symbol (SProxy(..))
2019
import Data.Time (Time)
2120
import Data.Traversable (for, for_)
2221
import Data.Tuple (Tuple(..))
@@ -31,6 +30,7 @@ import Halogen.Datepicker.Config (Config, defaultConfig)
3130
import Halogen.Datepicker.Format.DateTime as F
3231
import Halogen.Datepicker.Internal.Utils (componentProps, foldSteps, mustBeMounted, pickerProps, transitionState)
3332
import Halogen.HTML as HH
33+
import Type.Proxy (Proxy(..))
3434

3535
type State = PickerValue DateTimeError DateTime
3636
type DateTimeError = DateTimeErrorF Maybe
@@ -47,23 +47,23 @@ type Slots =
4747
, time Time.Slot Unit
4848
)
4949

50-
_date = SProxy SProxy "date"
51-
_time = SProxy SProxy "time"
50+
_date = Proxy Proxy "date"
51+
_time = Proxy Proxy "time"
5252

5353
type Slot = H.Slot Query Message
5454

5555
type HTML m = H.ComponentHTML Action Slots m
5656
type DSL = H.HalogenM State Action Slots Message
5757

58-
picker m. MonadError Ex.Error m F.Format H.Component HH.HTML Query Unit Message m
58+
picker m. MonadError Ex.Error m F.Format H.Component Query Unit Message m
5959
picker = pickerWithConfig defaultConfig
6060

6161
pickerWithConfig
6262
m
6363
. MonadError Ex.Error m
6464
Config
6565
F.Format
66-
H.Component HH.HTML Query Unit Message m
66+
H.Component Query Unit Message m
6767
pickerWithConfig config format =
6868
H.mkComponent
6969
{ initialState: const Nothing
@@ -87,14 +87,14 @@ renderCommand config cmd = HH.div (componentProps config) $ pure case cmd of
8787
unit
8888
(Time.pickerWithConfig config fmt)
8989
unit
90-
(\val → Just (Right val))
90+
Right
9191
F.Date fmt →
9292
HH.slot
9393
_date
9494
unit
9595
(Date.pickerWithConfig config fmt)
9696
unit
97-
(\val → Just (Left val))
97+
Left
9898

9999
handleAction m. MonadError Ex.Error m F.Format Action DSL m Unit
100100
handleAction format msg = do
@@ -105,7 +105,7 @@ handleAction format msg = do
105105
Left (Tuple false _) → resetChildErrorBasedOnMessage msg
106106
_ → pure unit
107107
pure dt
108-
Just (Left err) → buildDateTime format
108+
Just (Left _) → buildDateTime format
109109
Just (Right dt) → pure $ lmap (Tuple false) case msg of
110110
Left newDate → case newDate of
111111
Just (Right date) → Right $ setDateDt date dt
@@ -162,7 +162,7 @@ buildDateTime format = do
162162
Maybe (Either (Tuple Boolean DateTimeError) DateTime)
163163
runStep childCount step = step <#> \(Join (Star f)) → case runWriter $ f bottom of
164164
Tuple res NothingRight res
165-
Tuple res (Just (Tuple (Additive errCount) err)) → Left $ Tuple
165+
Tuple _ (Just (Tuple (Additive errCount) err)) → Left $ Tuple
166166
-- if we hit errCount == 0 or errCount == childCount we shuoldn't force
167167
(errCount > 0 && errCount < childCount)
168168
(bimap unwrap unwrap err)

src/Halogen/DatePicker/Component/Duration.purs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,13 @@ import Data.Array (fold)
77
import Data.Bifunctor (lmap)
88
import Data.Either (Either(..))
99
import Data.Generic.Rep (class Generic)
10-
import Data.Generic.Rep.Show (genericShow)
1110
import Data.Interval (Duration)
1211
import Data.Interval.Duration.Iso (IsoDuration, mkIsoDuration, unIsoDuration, Errors)
1312
import Data.Maybe (Maybe(..), fromMaybe)
1413
import Data.Monoid.Endo (Endo(..))
1514
import Data.Newtype (unwrap)
15+
import Data.Show.Generic (genericShow)
1616
import Data.String (take)
17-
import Data.Symbol (SProxy(..))
1817
import Data.Traversable (for)
1918
import Data.Tuple (Tuple(..))
2019
import Effect.Exception as Ex
@@ -27,6 +26,7 @@ import Halogen.Datepicker.Internal.Num as Num
2726
import Halogen.Datepicker.Internal.Range (minRange)
2827
import Halogen.Datepicker.Internal.Utils (asRight, componentProps, foldSteps, handlePickerQuery, mustBeMounted, pickerProps, transitionState)
2928
import Halogen.HTML as HH
29+
import Type.Proxy (Proxy(..))
3030

3131
type State = PickerValue DurationError IsoDuration
3232

@@ -43,22 +43,22 @@ instance durationErrorShow ∷ Show DurationError where show = genericShow
4343

4444
type Slots = (num Num.Slot Number F.Command)
4545

46-
_num = SProxy SProxy "num"
46+
_num = Proxy Proxy "num"
4747

4848
type Slot = H.Slot Query Message
4949

5050
type HTML m = H.ComponentHTML Action Slots m
5151
type DSL = H.HalogenM State Action Slots Message
5252

53-
picker m. MonadError Ex.Error m F.Format H.Component HH.HTML Query Unit Message m
53+
picker m. MonadError Ex.Error m F.Format H.Component Query Unit Message m
5454
picker = pickerWithConfig defaultConfig
5555

5656
pickerWithConfig
5757
m
5858
. MonadError Ex.Error m
5959
Config
6060
F.Format
61-
H.Component HH.HTML Query Unit Message m
61+
H.Component Query Unit Message m
6262
pickerWithConfig config format =
6363
H.mkComponent
6464
{ initialState: const Nothing
@@ -80,7 +80,7 @@ renderCommand config cmd =
8080
cmd
8181
(Num.picker Num.numberHasNumberInputVal $ toNumConf config { title: show cmd, placeholder: take 1 (show cmd), range: minRange 0.0 })
8282
unit
83-
(\n → Just (Tuple cmd n))
83+
(Tuple cmd)
8484
]
8585

8686
getComponent F.Command IsoDuration Number
@@ -113,7 +113,7 @@ buildDuration format = do
113113
where
114114
mkBuildStep F.Command DSL m BuildStep
115115
mkBuildStep cmd = do
116-
num ← query cmd $ H.request GetValue
116+
num ← query cmd $ H.mkRequest GetValue
117117
pure $ num <#> F.toSetter cmd >>> Endo
118118
runStep BuildStep Maybe (Either Errors IsoDuration)
119119
runStep step = step <#> \(Endo f) → mkIsoDuration $ f mempty
@@ -122,7 +122,7 @@ propagateChange ∷ ∀ m. MonadError Ex.Error m ⇒ F.Format → State → DSL
122122
propagateChange format duration = do
123123
map fold $ for (unwrap format) \cmd → do
124124
let n = duration >>= asRight >>= unIsoDuration >>> F.toGetter cmd
125-
query cmd $ H.request (SetValue n)
125+
query cmd $ H.mkRequest (SetValue n)
126126

127127
query m. MonadError Ex.Error m F.Command Num.Query Number ~> DSL m
128128
query cmd q = H.query _num cmd q >>= mustBeMounted

0 commit comments

Comments
 (0)