Skip to content

Commit bb95879

Browse files
committed
Init
0 parents  commit bb95879

14 files changed

Lines changed: 1964 additions & 0 deletions

File tree

.gitignore

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
/bower_components/
2+
/node_modules/
3+
/.pulp-cache/
4+
/output/
5+
/generated-docs/
6+
/.psc-package/
7+
/.psc*
8+
/.purs*
9+
/.psa*
10+
/.spago
11+
/.parcel-cache/
12+
/dist/

README.md

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
# purescript-marionette-react-basic
2+
3+
A [`react-basic-hooks`](https://github.com/megamaddu/purescript-react-basic-hooks) renderer for [`marionette`](https://github.com/thought2/purescript-marionette) that provides a simple `useMarionette` hook
4+
5+
6+
## Documentation
7+
8+
- Module documentation is [published on Pursuit](http://pursuit.purescript.org/packages/purescript-marionette-react-basic).
9+
10+
11+
## Installation
12+
13+
```
14+
spago install marionette
15+
spago install marionette-react-basic
16+
```
17+
18+
```
19+
spago install react-basic-hooks
20+
spago install react-basic-dom
21+
spago install react-basic
22+
23+
```
24+
25+
## Example
26+
27+
You can run the examples in this repo with:
28+
29+
```text
30+
spago build
31+
yarn install
32+
```
33+
34+
And then e.g.:
35+
36+
```
37+
yarn parcel assets/CountDown.html
38+
```

assets/CountDown.html

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="UTF-8">
5+
<meta http-equiv="X-UA-Compatible" content="IE=edge">
6+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
7+
<title>PureScript React App with Marionette</title>
8+
<script async type="module" src="CountDown.js"></script>
9+
</head>
10+
<body>
11+
<div id="root"></div>
12+
</body>
13+
</html>

assets/CountDown.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
import { main } from "../output/Test.Examples.CountDown";
2+
3+
main();

flake.lock

Lines changed: 58 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

flake.nix

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
2+
{
3+
description = "purescript-marionette-react-basic";
4+
5+
inputs.nixpkgs.url = "nixpkgs";
6+
7+
inputs.easy-purescript-nix = {
8+
url = github:justinwoo/easy-purescript-nix;
9+
flake = false;
10+
};
11+
12+
inputs.flake-utils.url = github:numtide/flake-utils;
13+
14+
outputs = inputs:
15+
inputs.flake-utils.lib.eachSystem [ "x86_64-linux" ] (system:
16+
let
17+
overlays = [
18+
(prev: final: {
19+
inherit (easy-purescript-nix) purs-tidy;
20+
purescript = easy-purescript-nix.purs-0_15_4;
21+
psa = easy-purescript-nix.psa;
22+
zephyr = easy-purescript-nix.zephyr;
23+
})
24+
];
25+
26+
pkgs = import
27+
inputs.nixpkgs
28+
{
29+
inherit system;
30+
inherit overlays;
31+
};
32+
33+
easy-purescript-nix = import inputs.easy-purescript-nix { inherit pkgs; };
34+
35+
in
36+
37+
{
38+
devShell = pkgs.mkShell {
39+
nativeBuildInputs = [
40+
pkgs.purescript
41+
pkgs.psa
42+
pkgs.purs-tidy
43+
pkgs.bashInteractive
44+
pkgs.spago
45+
pkgs.nodePackages.prettier
46+
pkgs.just
47+
pkgs.yarn
48+
];
49+
};
50+
}
51+
);
52+
}

package.json

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
{
2+
"name": "purescript-marionette-react-basic",
3+
"version": "1.0.0",
4+
"main": "index.js",
5+
"license": "MIT",
6+
"devDependencies": {
7+
"parcel": "^2.8.2",
8+
"process": "^0.11.10",
9+
"react": "^18.2.0",
10+
"react-dom": "^18.2.0"
11+
}
12+
}

packages.dhall

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
let upstream =
2+
https://github.com/purescript/package-sets/releases/download/psc-0.15.4-20221229/packages.dhall
3+
sha256:a6af1091425f806ec0da34934bb6c0ab0ac1598620bbcbb60a7d463354e7d87c
4+
5+
in upstream
6+
7+
with marionette =
8+
{ dependencies =
9+
[ "aff"
10+
, "arrays"
11+
, "console"
12+
, "datetime"
13+
, "effect"
14+
, "either"
15+
, "enums"
16+
, "foldable-traversable"
17+
, "maybe"
18+
, "newtype"
19+
, "node-readline"
20+
, "now"
21+
, "ordered-collections"
22+
, "prelude"
23+
, "refs"
24+
, "strings"
25+
, "transformers"
26+
, "tuples"
27+
]
28+
, repo =
29+
"https://github.com/thought2/purescript-marionette.git"
30+
, version =
31+
"next"
32+
}

spago.dhall

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
{ name = "purescript-marionette-react-basic"
2+
, dependencies =
3+
[ "aff"
4+
, "aff-promise"
5+
, "console"
6+
, "effect"
7+
, "exceptions"
8+
, "marionette"
9+
, "maybe"
10+
, "newtype"
11+
, "prelude"
12+
, "react-basic"
13+
, "react-basic-dom"
14+
, "react-basic-hooks"
15+
, "transformers"
16+
, "tuples"
17+
, "unsafe-coerce"
18+
, "web-dom"
19+
, "web-html"
20+
]
21+
, packages = ./packages.dhall
22+
, sources = [ "src/**/*.purs", "test/**/*.purs" ]
23+
}

src/Marionette/ReactBasic.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
export const reactSetterToStateImpl = ({ fst, snd }) => setState => f => () =>
2+
new Promise((res) => {
3+
setState((s_) => {
4+
let tpl = f(s_)
5+
let a = fst(tpl)
6+
let s = snd(tpl)
7+
res(a)
8+
return s
9+
})()
10+
})

0 commit comments

Comments
 (0)