Skip to content

Conversation

paf31
Copy link
Contributor

@paf31 paf31 commented Mar 12, 2017

Fixes #2734

It looks like this:

$ echo "import Prelude" > .purs-repl
$ psc-package repl
PSCi, version 0.11.0
Type :? for help

import Prelude
> 1 + 1
2

cc @chexxor

@hdgarrood
Copy link
Contributor

Does this allow you to put basically anything inside .psci? Not that I feel particularly strongly that we should be restricting it, but it might be worth discussing.

@paf31
Copy link
Contributor Author

paf31 commented Mar 12, 2017

Yes it does right now. I think it might be better to limit it to imports only. There is also a security risk associated with running arbitrary code on behalf of the user.

@paf31
Copy link
Contributor Author

paf31 commented Mar 12, 2017

Fixed.

Copy link
Contributor

@hdgarrood hdgarrood left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 I'll let you decide what you want to do about my comment.

case parseCommand l of
Left err -> liftIO (putStrLn err >> exitFailure)
Right cmd@Import{} -> handleCommand' state cmd
Right _ -> liftIO (putStrLn "Only import declarations are supported in the .psci file" >> exitFailure)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Might be nicer to print a warning, ignore declarations which aren't imports, and continue?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sounds good

@hdgarrood
Copy link
Contributor

👍

@kritzcreek
Copy link
Member

kritzcreek commented Mar 12, 2017

.psci seems inconsistent after purs repl. Let's call it .purs-repl?

@paf31
Copy link
Contributor Author

paf31 commented Mar 12, 2017

Yeah, that makes sense. It is called PSCi elsewhere though.

@paf31 paf31 merged commit 3a02726 into master Mar 13, 2017
@paf31 paf31 deleted the phil/dotpsci branch March 13, 2017 00:14
mrkgnao pushed a commit to mrkgnao/purescript that referenced this pull request Mar 13, 2017
* Add back .psci file support

* Restrict .psci to import statements

* Only warn

* Use .purs-repl
mrkgnao pushed a commit to mrkgnao/purescript that referenced this pull request Mar 13, 2017
* Add back .psci file support

* Restrict .psci to import statements

* Only warn

* Use .purs-repl
@paf31 paf31 changed the title Add back .psci file support Add back .purs-repl file support Mar 15, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants