-
Notifications
You must be signed in to change notification settings - Fork 51
Expand file tree
/
Copy pathMain.purs
More file actions
66 lines (62 loc) · 2 KB
/
Main.purs
File metadata and controls
66 lines (62 loc) · 2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
module Main where
import Prelude
import Data.Foldable (fold)
import Effect (Effect)
import TryPureScript (h1, h2, p, text, list, indent, link, render, code)
main :: Effect Unit
main =
render $ fold
[ h1 (text "Try PureScript!")
, p (text "Try out the examples below, or create your own!")
, h2 (text "Examples")
, list (map fromExample examples)
, h2 (text "Share Your Code")
, p (text "A PureScript file can be loaded from GitHub from a gist or a repository. To share code using a gist, simply include the gist ID in the URL as follows:")
, indent (p (code (text " try.purescript.org?gist=<gist id>")))
, p (fold
[ text "The gist should contain PureScript module named "
, code (text "Main")
, text " in a file named "
, code (text "Main.purs")
, text " containing your PureScript code."
])
, p (text "To share code from a repository, include the path to the source file as follows:")
, indent (p (code (text " try.purescript.org?github=/<owner>/<repo>/<branch or tag>/<file>.purs")))
, p (fold
[ text "The file should be a PureScript module named "
, code (text "Main")
, text " containing your PureScript code."
])
]
where
fromExample { title, source } =
link ("https://github.com/purescript/trypurescript/blob/master/client/examples/" <> source) (text title)
examples =
[ { title: "Algebraic Data Types"
, source: "ADTs.purs"
}
, { title: "Loops"
, source: "Loops.purs"
}
, { title: "Operators"
, source: "Operators.purs"
}
, { title: "Records"
, source: "Records.purs"
}
, { title: "Recursion"
, source: "Recursion.purs"
}
, { title: "Do Notation"
, source: "DoNotation.purs"
}
, { title: "Type Classes"
, source: "TypeClasses.purs"
}
, { title: "Generic Programming"
, source: "Generic.purs"
}
, { title: "QuickCheck"
, source: "QuickCheck.purs"
}
]