README.md 2.68 KB
Newer Older
Isaac Shapira's avatar
Isaac Shapira committed
1
2
# Isreal Swan

Isaac Shapira's avatar
Isaac Shapira committed
3
4
5
6
7
8
9
10
[![Goldwater](https://gitlab.com/platonic/shpadoinkle/badges/master/pipeline.svg)](https://gitlab.com/platonic/shpadoinkle)
[![Haddock](https://img.shields.io/badge/haddock-master-informational)](https://shpadoinkle.org/isreal)
[![GPL-3](https://img.shields.io/badge/License-GPL%203--Clause-blue.svg)](https://opensource.org/licenses/gpl-3.0.html)
[![built with nix](https://img.shields.io/badge/built%20with-nix-41439a)](https://builtwithnix.org)
[![Hackage](https://img.shields.io/hackage/v/Shpadoinkle-isreal.svg)](https://hackage.haskell.org/package/Shpadoinkle-html)
[![Hackage Deps](https://img.shields.io/hackage-deps/v/Shpadoinkle-isreal.svg)](http://packdeps.haskellers.com/reverse/Shpadoinkle-html)
[![Hackage CI](https://matrix.hackage.haskell.org/api/v2/packages/Shpadoinkle-isreal/badge)](https://matrix.hackage.haskell.org/#/package/Shpadoinkle-html)

Isaac Shapira's avatar
Isaac Shapira committed
11
12
Snowman as a service

Isaac Shapira's avatar
Isaac Shapira committed
13
> If you build me a snowman, then I'll build one for you.
Isaac Shapira's avatar
Isaac Shapira committed
14

Chloe Kever's avatar
Chloe Kever committed
15
16
17
This service is hosted at https://isreal.shpadoinkle.org. It allows you to post
Shpadoinkle code and see the resulting UI in your browser. For example, let's say we have
the local file `Hello.hs`, containing:
Isaac Shapira's avatar
Isaac Shapira committed
18

Isaac Shapira's avatar
Isaac Shapira committed
19
20
```haskell
module Main where
Isaac Shapira's avatar
Isaac Shapira committed
21
22


Isaac Shapira's avatar
Isaac Shapira committed
23
24
25
import           Shpadoinkle
import           Shpadoinkle.Backend.ParDiff
import           Shpadoinkle.Html
Isaac Shapira's avatar
Isaac Shapira committed
26
27


Isaac Shapira's avatar
Isaac Shapira committed
28
29
view :: () -> Html m ()
view _ = "hello world"
Isaac Shapira's avatar
Isaac Shapira committed
30
31


Isaac Shapira's avatar
Isaac Shapira committed
32
33
34
35
main :: IO ()
main = runJSorWarp 8080 $ simple runParDiff () view getBody
```

Chloe Kever's avatar
Chloe Kever committed
36
You can send this to Isreal Swan with the following `curl` command:
Isaac Shapira's avatar
Isaac Shapira committed
37
38

```bash
Isaac Shapira's avatar
Isaac Shapira committed
39
curl -X POST -H "Content-Type:application/octet-stream" --data-binary @Hello.hs \
Isaac Shapira's avatar
Isaac Shapira committed
40
  https://isreal.shpadoinkle.org/compile/hello-token?nonce=0
Isaac Shapira's avatar
Isaac Shapira committed
41
42
```

Isaac Shapira's avatar
Isaac Shapira committed
43
44
You should increment the nonce for browser cache busting.

Isaac Shapira's avatar
Isaac Shapira committed
45
Notice **hello-token** in the URL. It's _on you_ to make this a unique token for your work,
Isaac Shapira's avatar
Isaac Shapira committed
46
47
as the system is open-ended (any arbitrary (uri encoded) string is fine).
Reusing this token will result in incremental rebuilds, which
Isaac Shapira's avatar
Isaac Shapira committed
48
49
are much faster. Also please note, these spaces are ephemeral and will be deleted.

Chloe Kever's avatar
Chloe Kever committed
50
The `curl` command will respond with `Either` an error message from the compiler or
Isaac Shapira's avatar
Isaac Shapira committed
51
52
53
54
55
56
57
58
a message indicating success. If your code compiled successfully, you will be able to see
the resulting UI here:

`https://isreal.shpadoinkle.org/serve/hello-token/index.html`


## Deps & Such

Chloe Kever's avatar
Chloe Kever committed
59
Many common Haskell dependencies are provided.
Isaac Shapira's avatar
Isaac Shapira committed
60
The environment is based on the cabal file located [here](https://gitlab.com/platonic/shpadoinkle/-/blob/master/isreal/swan/swan.cabal).
Isaac Shapira's avatar
Isaac Shapira committed
61
62
63

## Clean Up

Chloe Kever's avatar
Chloe Kever committed
64
Clean up your token:
Isaac Shapira's avatar
Isaac Shapira committed
65
66

```bash
Isaac Shapira's avatar
Isaac Shapira committed
67
68
curl -X DELETE http://localhost:8080/clean/hello-token
```
Isaac Shapira's avatar
Isaac Shapira committed
69
70
71
72
73

## GPL License

Shpadoinkle Isreal (all files within this directory), are provided under the terms of the GNU
General Public License v3.0