Skip to content

Commit ae2f2d8

Browse files
Update for PureScript 0.14 (#45)
1 parent 8b91e55 commit ae2f2d8

File tree

9 files changed

+95
-57
lines changed

9 files changed

+95
-57
lines changed

.github/workflows/ci.yml

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

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/.*
22
!/.gitignore
33
!/.eslintrc.json
4-
!/.travis.yml
4+
!/.github/
55
package-lock.json
66
/bower_components/
77
/node_modules/

.travis.yml

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

README.md

Lines changed: 27 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,38 @@
11
# purescript-halogen-vdom
22

3+
[![Latest release](http://img.shields.io/github/release/purescript-halogen/purescript-halogen-vdom.svg)](https://github.com/purescript-halogen/purescript-halogen-vdom/releases)
4+
[![Build status](https://github.com/purescript-halogen/purescript-halogen-vdom/workflows/CI/badge.svg?branch=master)](https://github.com/purescript-halogen/purescript-halogen-vdom/actions?query=workflow%3ACI+branch%3Amaster)
5+
[![Pursuit](https://pursuit.purescript.org/packages/purescript-halogen-vdom/badge)](https://pursuit.purescript.org/packages/purescript-halogen-vdom)
6+
37
An extensible virtual-dom library for PureScript.
48

5-
## Overview
9+
## Installation
10+
11+
Install with Spago:
12+
13+
```
14+
spago install halogen-vdom
15+
```
616

7-
`Halogen.VDom` is a bare-bones virtual-dom library for PureScript with
8-
inspiration drawn from:
17+
## Quick Start
918

10-
* https://github.com/Matt-Esch/virtual-dom
11-
* https://github.com/paldepind/snabbdom
12-
* https://github.com/elm-lang/virtual-dom
19+
You can get started with `halogen-vdom` with these resources:
20+
21+
- Read the [guide](./GUIDE.md).
22+
- See the [test example](./test/Main.purs).
23+
24+
## Overview
1325

14-
It's goals being:
26+
`Halogen.VDom` is a bare-bones virtual-dom library for PureScript with inspiration drawn from:
1527

16-
1. To use as little FFI as possible.
17-
2. To be as fast as possible given (1).
18-
3. To be extensible.
28+
- https://github.com/Matt-Esch/virtual-dom
29+
- https://github.com/paldepind/snabbdom
30+
- https://github.com/elm-lang/virtual-dom
1931

20-
Notably, `Halogen.VDom` is largely useless out of the box. You'll need to bring
21-
your own attributes, properties, and event listeners (though there is a working
22-
implementation included). It is intended to be extended (and likely
23-
`newtype`d) by other frameworks to suit their needs.
32+
Its goals include:
2433

25-
---
34+
1. Use as little FFI as possible.
35+
2. Be as fast as possible given (1).
36+
3. Be extensible.
2637

27-
* Read the [guide](./GUIDE.md).
28-
* See the [test example](./test/Main.purs).
38+
Notably, `Halogen.VDom` is largely useless out of the box. You'll need to bring your own attributes, properties, and event listeners (though there is a working implementation included). It is intended to be extended (and likely `newtype`d) by other frameworks to suit their needs.

bower.json

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "purescript-halogen-vdom",
3-
"homepage": "https://github.com/slamdata/purescript-halogen-vdom",
3+
"homepage": "https://github.com/purescript-halogen/purescript-halogen-vdom",
44
"authors": [
55
"Nathan Faubion <[email protected]>"
66
],
@@ -12,7 +12,7 @@
1212
],
1313
"repository": {
1414
"type": "git",
15-
"url": "git://github.com/slamdata/purescript-halogen-vdom.git"
15+
"url": "https://github.com/purescript-halogen/purescript-halogen-vdom.git"
1616
},
1717
"license": "Apache-2.0",
1818
"ignore": [
@@ -22,19 +22,18 @@
2222
"output"
2323
],
2424
"dependencies": {
25-
"purescript-prelude": "^4.0.0",
26-
"purescript-effect": "^2.0.0",
27-
"purescript-tuples": "^5.0.0",
28-
"purescript-web-html": "^2.0.0",
29-
"purescript-foreign-object": "^2.0.1",
30-
"purescript-maybe": "^4.0.0",
31-
"purescript-unsafe-coerce": "^4.0.0",
32-
"purescript-bifunctors": "^4.0.0",
33-
"purescript-refs": "^4.1.0",
34-
"purescript-foreign": "^5.0.0"
25+
"purescript-prelude": "master",
26+
"purescript-effect": "master",
27+
"purescript-tuples": "master",
28+
"purescript-web-html": "master",
29+
"purescript-foreign-object": "master",
30+
"purescript-maybe": "master",
31+
"purescript-unsafe-coerce": "master",
32+
"purescript-bifunctors": "master",
33+
"purescript-refs": "master",
34+
"purescript-foreign": "master"
3535
},
3636
"devDependencies": {
37-
"purescript-js-timers": "^4.0.0",
38-
"purescript-exists": "^4.0.0"
37+
"purescript-exists": "master"
3938
}
4039
}

package.json

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,8 @@
66
"build": "pulp build -- --censor-lib --strict"
77
},
88
"devDependencies": {
9-
"pulp": "^12.3.1",
10-
"purescript": "^0.12.3",
11-
"purescript-psa": "^0.7.3",
12-
"rimraf": "^2.6.3"
9+
"pulp": "^15.0.0",
10+
"purescript-psa": "^0.8.0",
11+
"rimraf": "^3.0.2"
1312
}
1413
}

src/Halogen/VDom/Thunk.purs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ foreign import data ThunkArg ∷ Type
2424

2525
foreign import data ThunkIdType
2626

27+
data Thunk :: (Type -> Type) -> Type -> Type
2728
data Thunk f i = Thunk ThunkId (Fn.Fn2 ThunkArg ThunkArg Boolean) (ThunkArg f i) ThunkArg
2829

2930
unsafeThunkId a. a ThunkId
@@ -86,6 +87,7 @@ unsafeEqThunk = Fn.mkFn2 \(Thunk a1 b1 _ d1) (Thunk a2 b2 _ d2) →
8687
Fn.runFn2 Util.refEq b1 b2 &&
8788
Fn.runFn2 b1 d1 d2
8889

90+
type ThunkState :: (Type -> Type) -> Type -> Type -> Type -> Type
8991
type ThunkState f i a w =
9092
{ thunk Thunk f i
9193
, vdom M.Step (V.VDom a w) Node

test/Main.js

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,17 +3,25 @@ exports.getData = function () {
33
};
44

55
exports.getTimeout = function () {
6-
return ENV.timeout
6+
return ENV.timeout;
77
};
88

99
exports.pingRenderRate = function () {
1010
Monitoring.renderRate.ping();
1111
};
1212

13+
exports.setTimeout = function (ms) {
14+
return function (fn) {
15+
return function () {
16+
return setTimeout(fn, ms);
17+
};
18+
};
19+
};
20+
1321
exports.requestAnimationFrame = function (f) {
1422
return function () {
1523
window.requestAnimationFrame(function () {
1624
f();
1725
});
18-
}
19-
}
26+
};
27+
};

test/Main.purs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ import Data.Newtype (class Newtype, un, wrap)
1010
import Data.Tuple (Tuple(..))
1111
import Effect (Effect)
1212
import Effect.Ref as Ref
13-
import Effect.Timer as Timer
1413
import Effect.Uncurried as EFn
1514
import Halogen.VDom as V
1615
import Halogen.VDom.DOM.Prop (Prop(..), propFromString, buildProp)
@@ -128,6 +127,8 @@ foreign import pingRenderRate ∷ Effect Unit
128127

129128
foreign import requestAnimationFrame Effect Unit Effect Unit
130129

130+
foreign import setTimeout :: Int -> Effect Unit -> Effect Int
131+
131132
mkRenderQueue
132133
a
133134
. V.VDomSpec (Array (Prop Void)) (Thunk VDom Void)
@@ -180,5 +181,5 @@ main = do
180181
timeout ← getTimeout
181182
pushQueue newData
182183
pingRenderRate
183-
void (Timer.setTimeout timeout loop)
184+
void (setTimeout timeout loop)
184185
loop

0 commit comments

Comments
 (0)