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

Commit

Permalink
Parsers (#3)
Browse files Browse the repository at this point in the history
* argonaut codecs

* arbitrary instances

* parsers

* comments, foreachE

* updated ejson dep
  • Loading branch information
cryogenian authored Apr 19, 2017
1 parent aee7669 commit aef9ce4
Show file tree
Hide file tree
Showing 32 changed files with 2,848 additions and 1,299 deletions.
5 changes: 1 addition & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,7 @@ bower install purescript-sqlsquare

## Documentation

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


Module documentation is published on Pursuit: [http://pursuit.purescript.org/packages/purescript-sqlsquare](http://pursuit.purescript.org/packages/purescript-sqlsquare)
2 changes: 1 addition & 1 deletion bower.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
"purescript-pathy": "^3.0.2",
"purescript-profunctor": "^2.0.0",
"purescript-profunctor-lenses": "^2.6.0",
"purescript-ejson": "^7.0.0"
"purescript-ejson": "^8.0.0"
},
"devDependencies": {
"purescript-argonaut": "^2.0.0",
Expand Down
36 changes: 34 additions & 2 deletions src/SqlSquare.purs
Original file line number Diff line number Diff line change
@@ -1,9 +1,41 @@
module SqlSquare
( module AST
( Sql
, print
, encodeJson
, decodeJson
, arbitrarySqlOfSize
, module Sig
, module Lenses
, module Constructors
, module Parser
) where

import SqlSquare.AST as AST
import Prelude

import Data.Argonaut as J
import Data.Either (Either)
import Data.Functor.Mu (Mu)
import Data.Json.Extended as EJ

import Matryoshka (cata, anaM)

import SqlSquare.Signature as Sig
import SqlSquare.Lenses as Lenses
import SqlSquare.Constructors as Constructors
import SqlSquare.Parser as Parser

import Test.StrongCheck.Gen as Gen

type Sql = Mu (Sig.SqlF EJ.EJsonF)

print Sql String
print = cata $ Sig.printSqlF EJ.renderEJsonF

encodeJson Sql J.Json
encodeJson = cata $ Sig.encodeJsonSqlF EJ.encodeJsonEJsonF

decodeJson J.Json Either String Sql
decodeJson = anaM $ Sig.decodeJsonSqlF EJ.decodeJsonEJsonF

arbitrarySqlOfSize Int Gen.Gen Sql
arbitrarySqlOfSize = anaM $ Sig.arbitrarySqlF EJ.arbitraryEJsonF
Loading

0 comments on commit aef9ce4

Please sign in to comment.