Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adds a repl #73

Draft
wants to merge 12 commits into
base: main
Choose a base branch
from
Draft

Adds a repl #73

wants to merge 12 commits into from

Conversation

solomon-b
Copy link
Contributor

@solomon-b solomon-b commented Sep 15, 2022

Launching the repl

➜ cabal run kriti-repl
Kriti Lang, version 0.3.2: github.com/hasura/kriti-lang/ :? for help
> 

Using it

> {{ {"foo": 4} }}
{
    "foo": 4
}
> {{ {"foo": 4}.foo }}
4
> {{ 1 == 2 }}
false
> :let $ ./test/data/eval/success/source.json
> {{ $[0].isActive }}
false
> :let x = http://httpbin.org/json
> x
{
    "slideshow": {
        "author": "Yours Truly",
        "date": "date of publication",
        "slides": [
            {
                "title": "Wake up to WonderWidgets!",
                "type": "all"
            },
            {
                "items": [
                    "Why <em>WonderWidgets</em> are great",
                    "Who <em>buys</em> WonderWidgets"
                ],
                "title": "Overview",
                "type": "all"
            }
        ],
        "title": "Sample Slide Show"
    }
}

@solomon-b solomon-b requested a review from sordina September 15, 2022 08:34
@solomon-b solomon-b force-pushed the feature/repl branch 2 times, most recently from 853284b to d094841 Compare September 15, 2022 22:32
@solomon-b solomon-b marked this pull request as ready for review September 15, 2022 23:15
@sordina
Copy link
Contributor

sordina commented Sep 16, 2022

Looks great!

The one recommendation I'd make is to support the stdin/stdout patterns by outputting non-evaluation content to STDERR and not prefixing output with >:

> echo '{}' | /Users/lyndon/hasura/kriti-lang/dist-newstyle/build/x86_64-osx/ghc-8.10.7/kriti-lang-0.3.2/x/kriti-repl/build/kriti-repl/kriti-repl 2>/dev/null
Kriti Lang, version 0.3.2: github.com/hasura/kriti-lang/ :? for help
> {}
> Goodbye!

Would be better as:

> echo '{}' | /Users/lyndon/hasura/kriti-lang/dist-newstyle/build/x86_64-osx/ghc-8.10.7/kriti-lang-0.3.2/x/kriti-repl/build/kriti-repl/kriti-repl 2>/dev/null
{}

So that it could be used in scripts more easily.

@solomon-b solomon-b changed the base branch from feature/split-array-and-object-inedxing to main September 16, 2022 05:23
@solomon-b solomon-b marked this pull request as draft November 11, 2022 21:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants