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

How to specify examples on CLI mode? #161

Open
masaomi-yamaguchi opened this issue Mar 30, 2021 · 4 comments
Open

How to specify examples on CLI mode? #161

masaomi-yamaguchi opened this issue Mar 30, 2021 · 4 comments

Comments

@masaomi-yamaguchi
Copy link

I want to try your project on my computer.
I successfully build Hoogle+ by Docker Image and confirmed
stack exec -- hplus "Maybe a -> [a] -> a"
, which is in READE, works well.
However, I cannot find a way to specify examples on CLI.
In the demo version https://hoogleplus.goto.ucsd.edu/, I can use examples.
Is this the extension of CLI mode, or is there some way to specify the example in CLI mode?

@mistzzt
Copy link
Collaborator

mistzzt commented Mar 30, 2021

is there some way to specify the example in CLI mode?

The demo version is in oopsla20_revision.

As shown in the README file, you can try the following command:

stack exec -- hplus --json='{"query": "Eq a => [a] -> [a]", \
                             "inExamples": [{ "inputs": ["\"aaabbbab\""], "output": "\"abab\""}]}'

@mistzzt mistzzt closed this as completed Mar 30, 2021
@masaomi-yamaguchi
Copy link
Author

Thank you a lot!
I confirmed I can specify input-output examples.

However, I cannot use the command in oopsla20_revision:

stack exec -- hplus generate -p base  -p bytestring -m "Data.Word" -m "Data.Int" -m "Data.Maybe" -m "Data.ByteString.Builder" -m "Data.ByteString.Lazy" -m "Data.List" -m "Data.Tuple" -m "GHC.List" -m "GHC.Char" -m "Data.Bool"  -m "Text.Show"

When I run above command, following result is shown:

Unknown flag: -p

How to solve this?

@mistzzt
Copy link
Collaborator

mistzzt commented Apr 9, 2021

It seems like the README.md file is inaccurate about this option. :)

Try to replace -p with --pkg-name.

# stack exec -- hplus generate --help
hoogleplus v0.1, 2019-03-10

hoogleplus generate [OPTIONS]
  Generate the type conversion database for synthesis

Flags:
     --preset=PRESET           Environment preset to use
  -f --files=ITEM              Files to use to generate from. Exclusive with
                               packages and modules. Takes precedence
     --pkg-name=ITEM           Package names to be generated
  -m --module-name=ITEM        Module names to be generated in the given
                               packages
  -t --type-depth=INT          Depth of the types to be instantiated for
                               polymorphic type constructors
     --higher-order            Include higher order functions (default: True)
  -e --env-file-path-out=ITEM
     --ho-path=FILE            Filename of components to be used as higher
                               order arguments

@masaomi-yamaguchi
Copy link
Author

Thank you for your reply. I tried

stack exec -- hplus generate --pkg-name base -m "Data.Int"

, but this error happened:

root@e85cf5f88368:/home/hoogle_plus# stack exec -- hplus generate --pkg-name base -m "Data.Int"Downloading file base from Hackage...
hplus: dieVerbatim: user error (hplus: Failed parsing "/tmp/base.cabal".
)```

@mistzzt mistzzt reopened this May 19, 2021
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

No branches or pull requests

2 participants