Skip to content
This repository was archived by the owner on Jun 15, 2023. It is now read-only.

Commit aef9ce4

Browse files
authored
Parsers (#3)
* argonaut codecs * arbitrary instances * parsers * comments, foreachE * updated ejson dep
1 parent aee7669 commit aef9ce4

32 files changed

+2848
-1299
lines changed

README.md

+1-4
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,7 @@ bower install purescript-sqlsquare
1313

1414
## Documentation
1515

16-
There are two examples (extracted from [slamdata](https://github.com/slamdata/slamdata))
16+
There is an example (extracted from [slamdata](https://github.com/slamdata/slamdata))
1717
+ Extraction sql fields from array of jsons: [here](test/src/Argonaut.purs)
18-
+ Interpretation query language of [purescript-search](https://github.com/slamdata/purescript-search):
19-
[here](test/src/Search.purs)
20-
2118

2219
Module documentation is published on Pursuit: [http://pursuit.purescript.org/packages/purescript-sqlsquare](http://pursuit.purescript.org/packages/purescript-sqlsquare)

bower.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
"purescript-pathy": "^3.0.2",
2121
"purescript-profunctor": "^2.0.0",
2222
"purescript-profunctor-lenses": "^2.6.0",
23-
"purescript-ejson": "^7.0.0"
23+
"purescript-ejson": "^8.0.0"
2424
},
2525
"devDependencies": {
2626
"purescript-argonaut": "^2.0.0",

src/SqlSquare.purs

+34-2
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,41 @@
11
module SqlSquare
2-
( module AST
2+
( Sql
3+
, print
4+
, encodeJson
5+
, decodeJson
6+
, arbitrarySqlOfSize
7+
, module Sig
38
, module Lenses
49
, module Constructors
10+
, module Parser
511
) where
612

7-
import SqlSquare.AST as AST
13+
import Prelude
14+
15+
import Data.Argonaut as J
16+
import Data.Either (Either)
17+
import Data.Functor.Mu (Mu)
18+
import Data.Json.Extended as EJ
19+
20+
import Matryoshka (cata, anaM)
21+
22+
import SqlSquare.Signature as Sig
823
import SqlSquare.Lenses as Lenses
924
import SqlSquare.Constructors as Constructors
25+
import SqlSquare.Parser as Parser
26+
27+
import Test.StrongCheck.Gen as Gen
28+
29+
type Sql = Mu (Sig.SqlF EJ.EJsonF)
30+
31+
print Sql String
32+
print = cata $ Sig.printSqlF EJ.renderEJsonF
33+
34+
encodeJson Sql J.Json
35+
encodeJson = cata $ Sig.encodeJsonSqlF EJ.encodeJsonEJsonF
36+
37+
decodeJson J.Json Either String Sql
38+
decodeJson = anaM $ Sig.decodeJsonSqlF EJ.decodeJsonEJsonF
39+
40+
arbitrarySqlOfSize Int Gen.Gen Sql
41+
arbitrarySqlOfSize = anaM $ Sig.arbitrarySqlF EJ.arbitraryEJsonF

0 commit comments

Comments
 (0)