Skip to content

Commit dcbed46

Browse files
committed
Merge pull request #1 from cryogenian/master
Extracted core
2 parents d3c5cee + ef1a42a commit dcbed46

File tree

16 files changed

+947
-0
lines changed

16 files changed

+947
-0
lines changed

.gitignore

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
/.*
2+
!/.gitignore
3+
!/.travis.yml
4+
bower_components/
5+
node_modules/
6+
output/
7+
dist/
8+
npm-debug.log

.travis.yml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
language: node_js
2+
node_js:
3+
- 0.10
4+
env:
5+
- TAG=v0.7.0
6+
install:
7+
- wget -O $HOME/purescript.tar.gz https://github.com/purescript/purescript/releases/download/$TAG/linux64.tar.gz
8+
- sudo tar zxvf $HOME/purescript.tar.gz -C /usr/local/bin purescript/psc{,i,-docs,-bundle} --strip-components=1
9+
- sudo chmod a+x /usr/local/bin/psc{,i,-docs,-bundle}
10+
- npm install bower gulp -g
11+
- npm install && bower install
12+
script:
13+
- gulp test

README.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,17 @@
1+
[![Build Status](https://travis-ci.org/purescript-contrib/purescript-argonaut-core.svg?branch=master)](https://travis-ci.org/purescript-contrib/purescript-argonaut-core)
2+
13
# purescript-argonaut-core
4+
5+
Core part of __purescript-argonaut__ contains basic types for `Json`, folds over them, tests, printer and parser
6+
7+
## Installation
8+
9+
```shell
10+
bower install purescript-argonaut-core
11+
```
12+
13+
## Documentation
14+
15+
- [Data.Argonaut.Core](docs/Data/Argonaut/Core.md)
16+
- [Data.Argonaut.Parser](docs/Data/Argonaut/Parser.md)
17+
- [Data.Argonaut.Printer](docs/Data/Argonaut/Printer.md)

bower.json

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
{
2+
"name": "purescript-argonaut-core",
3+
"homepage": "https://github.com/purescript-contrib/purescript-argonaut-core",
4+
"authors": [
5+
"Maxim Zimaliev <[email protected]>",
6+
"Hardy Jones <>",
7+
"John A. De Goes <[email protected]>"
8+
],
9+
"description": "Core of purescript-argonaut library, it provides basic types, folds and combinators for `Json`",
10+
"keywords": [
11+
"purescript",
12+
"argonaut",
13+
"json"
14+
],
15+
"license": "MIT",
16+
"dependencies": {
17+
"purescript-prelude": "^0.1.0",
18+
"purescript-functions": "^0.1.0",
19+
"purescript-maybe": "^0.3.2",
20+
"purescript-tuples": "^0.4.0",
21+
"purescript-maps": "^0.4.0"
22+
},
23+
"devDependencies": {
24+
"purescript-eff": "^0.1.0",
25+
"purescript-console": "^0.1.0",
26+
"purescript-strongcheck": "^0.10.0",
27+
"purescript-foldable-traversable": "^0.4.0"
28+
}
29+
}

docs/Data/Argonaut/Core.md

Lines changed: 263 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,263 @@
1+
## Module Data.Argonaut.Core
2+
3+
#### `JBoolean`
4+
5+
``` purescript
6+
type JBoolean = Boolean
7+
```
8+
9+
#### `JNumber`
10+
11+
``` purescript
12+
type JNumber = Number
13+
```
14+
15+
#### `JString`
16+
17+
``` purescript
18+
type JString = String
19+
```
20+
21+
#### `JAssoc`
22+
23+
``` purescript
24+
type JAssoc = Tuple String Json
25+
```
26+
27+
#### `JArray`
28+
29+
``` purescript
30+
type JArray = Array Json
31+
```
32+
33+
#### `JObject`
34+
35+
``` purescript
36+
type JObject = StrMap Json
37+
```
38+
39+
#### `JNull`
40+
41+
``` purescript
42+
data JNull :: *
43+
```
44+
45+
##### Instances
46+
``` purescript
47+
instance eqJNull :: Eq JNull
48+
instance ordJNull :: Ord JNull
49+
instance showJNull :: Show JNull
50+
```
51+
52+
#### `Json`
53+
54+
``` purescript
55+
data Json :: *
56+
```
57+
58+
##### Instances
59+
``` purescript
60+
instance eqJson :: Eq Json
61+
instance ordJson :: Ord Json
62+
instance showJson :: Show Json
63+
```
64+
65+
#### `foldJson`
66+
67+
``` purescript
68+
foldJson :: forall a. (JNull -> a) -> (JBoolean -> a) -> (JNumber -> a) -> (JString -> a) -> (JArray -> a) -> (JObject -> a) -> Json -> a
69+
```
70+
71+
#### `foldJsonNull`
72+
73+
``` purescript
74+
foldJsonNull :: forall a. a -> (JNull -> a) -> Json -> a
75+
```
76+
77+
#### `foldJsonBoolean`
78+
79+
``` purescript
80+
foldJsonBoolean :: forall a. a -> (JBoolean -> a) -> Json -> a
81+
```
82+
83+
#### `foldJsonNumber`
84+
85+
``` purescript
86+
foldJsonNumber :: forall a. a -> (JNumber -> a) -> Json -> a
87+
```
88+
89+
#### `foldJsonString`
90+
91+
``` purescript
92+
foldJsonString :: forall a. a -> (JString -> a) -> Json -> a
93+
```
94+
95+
#### `foldJsonArray`
96+
97+
``` purescript
98+
foldJsonArray :: forall a. a -> (JArray -> a) -> Json -> a
99+
```
100+
101+
#### `foldJsonObject`
102+
103+
``` purescript
104+
foldJsonObject :: forall a. a -> (JObject -> a) -> Json -> a
105+
```
106+
107+
#### `isNull`
108+
109+
``` purescript
110+
isNull :: Json -> Boolean
111+
```
112+
113+
#### `isBoolean`
114+
115+
``` purescript
116+
isBoolean :: Json -> Boolean
117+
```
118+
119+
#### `isNumber`
120+
121+
``` purescript
122+
isNumber :: Json -> Boolean
123+
```
124+
125+
#### `isString`
126+
127+
``` purescript
128+
isString :: Json -> Boolean
129+
```
130+
131+
#### `isArray`
132+
133+
``` purescript
134+
isArray :: Json -> Boolean
135+
```
136+
137+
#### `isObject`
138+
139+
``` purescript
140+
isObject :: Json -> Boolean
141+
```
142+
143+
#### `toNull`
144+
145+
``` purescript
146+
toNull :: Json -> Maybe JNull
147+
```
148+
149+
#### `toBoolean`
150+
151+
``` purescript
152+
toBoolean :: Json -> Maybe JBoolean
153+
```
154+
155+
#### `toNumber`
156+
157+
``` purescript
158+
toNumber :: Json -> Maybe JNumber
159+
```
160+
161+
#### `toString`
162+
163+
``` purescript
164+
toString :: Json -> Maybe JString
165+
```
166+
167+
#### `toArray`
168+
169+
``` purescript
170+
toArray :: Json -> Maybe JArray
171+
```
172+
173+
#### `toObject`
174+
175+
``` purescript
176+
toObject :: Json -> Maybe JObject
177+
```
178+
179+
#### `fromNull`
180+
181+
``` purescript
182+
fromNull :: JNull -> Json
183+
```
184+
185+
#### `fromBoolean`
186+
187+
``` purescript
188+
fromBoolean :: JBoolean -> Json
189+
```
190+
191+
#### `fromNumber`
192+
193+
``` purescript
194+
fromNumber :: JNumber -> Json
195+
```
196+
197+
#### `fromString`
198+
199+
``` purescript
200+
fromString :: JString -> Json
201+
```
202+
203+
#### `fromArray`
204+
205+
``` purescript
206+
fromArray :: JArray -> Json
207+
```
208+
209+
#### `fromObject`
210+
211+
``` purescript
212+
fromObject :: JObject -> Json
213+
```
214+
215+
#### `jsonNull`
216+
217+
``` purescript
218+
jsonNull :: Json
219+
```
220+
221+
#### `jsonTrue`
222+
223+
``` purescript
224+
jsonTrue :: Json
225+
```
226+
227+
#### `jsonFalse`
228+
229+
``` purescript
230+
jsonFalse :: Json
231+
```
232+
233+
#### `jsonZero`
234+
235+
``` purescript
236+
jsonZero :: Json
237+
```
238+
239+
#### `jsonEmptyArray`
240+
241+
``` purescript
242+
jsonEmptyArray :: Json
243+
```
244+
245+
#### `jsonEmptyObject`
246+
247+
``` purescript
248+
jsonEmptyObject :: Json
249+
```
250+
251+
#### `jsonSingletonArray`
252+
253+
``` purescript
254+
jsonSingletonArray :: Json -> Json
255+
```
256+
257+
#### `jsonSingletonObject`
258+
259+
``` purescript
260+
jsonSingletonObject :: String -> Json -> Json
261+
```
262+
263+

docs/Data/Argonaut/Parser.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
## Module Data.Argonaut.Parser
2+
3+
#### `jsonParser`
4+
5+
``` purescript
6+
jsonParser :: String -> Either String Json
7+
```
8+
9+

docs/Data/Argonaut/Printer.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
## Module Data.Argonaut.Printer
2+
3+
#### `Printer`
4+
5+
``` purescript
6+
class Printer a where
7+
printJson :: Json -> a
8+
```
9+
10+
##### Instances
11+
``` purescript
12+
instance printerString :: Printer String
13+
```
14+
15+

0 commit comments

Comments
 (0)