-
Notifications
You must be signed in to change notification settings - Fork 842
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
Improve experience for one-off experiments #1124
Comments
For one off files I typically use stack runghc, and install necessary packages with stack build package-name. The script interpreter feature may also be relevant, as it shows some of the ways you can use the command line options for this. |
I wasn't aware of stack build package-name; that should address point 4 above. |
I don't understand the value of 1 or 2 given stack ghc and stack runghc. What use case are you thinking would need them? |
You'd use stack.yaml to specify the resolver and, more importantly, extra deps. For instance, I want to play with gloss, but gloss isn't on stackage yet. |
As for (2): that would be a major regression for common use cases: we only want to build dependencies when they're necessary. Again, explicitly asking for a package to be built always works. |
I didn't know that either... and where do they get installed to? snapshot? global "default" db? how can you resolve eventual version incompatibilities (purge that database)? |
The implicit global if you're not in a project. It follows all the same rules as a normal project: packages in the snapshot get installed to that database, otherwise to the local database. And if you try to install a conflicting package, it unregisters the old one. You can certainly create a stack.yaml to avoid using the implicit global, I just don't see the value of changing |
Ok, I think this is good enough, thanks. What about |
@chrisdone you have any thoughts on the ghci aspects of this? |
The minimal feature I'd like is to have an extra entry in the YAML which says |
See https://github.com/ndmitchell/shake/blob/master/website/stack.yaml for a concrete example, including comments of what I have to run. The |
I'm worried about confusion with this issue regarding the original topic, the remaining GHCi point from above, and now the As I see it, what this field would do would be to augment the current I'm still a bit on the fence about it, since this fields pretty ad-hoc, but I don't have a moral objection to it. |
@snoyberg - yes, that's what I'm suggesting. It is ad hoc if you are defining a system for building packages. If you are defining a system for one off scripts, it seems more principled - you are specifying the script dependencies. (I dislike the Have you tried using Stack for one-off scripts yet? I guess there might be other features it requires to do it nicely, and I suspect myself and @feuerbach are groping around in the dark, but you might be able to see the overall principle. |
I've always used the script interpreter approach for that, which doesn't On Fri, Oct 16, 2015, 12:39 PM Neil Mitchell [email protected]
|
My personal experience has been that the script interpreter approach works well (including on Windows), and once a script reaches the point of complexity where it doesn't work well anymore, it's probably time for a .cabal file anyway. But I have no objection on principle to |
I'm really after the ghci case - I tend to open ghci and :main rather than runhaskell anyway. I spend most of my life in both ghci and ghcid, so I guess me and Michael average out as both using ghci. |
Just to chime in: this seems like a useful idea to me as well. My main concern is that we make the distinction between |
I haven't looked into detail yet, but #1217 may be related. |
My suspicion is that |
I don't think that's right. If a package is not in the snapshot, then it won't be available until you put it in extra-deps. |
But you aren't declaring extra dependencies, since these are already taken from the cabal file, you are only nailing down the dependencies you already have. Some of those aren't in the snapshot, so are required, but its only the constraint, not the dependency. Of course, I also think that the snapshot should have everything in Hackage, but everything not listed as the current stackage should be bound to the latest, which then gives you a reasonable default when putting nothing. |
#1361 looks like a dup of the Related to this discussion - I was once contemplating allowing |
stack works quite well for cabal projects, but it's not that convenient for quick experimentation, where I just want to write some code to a file and run it or play with it in ghci, without creating a cabal file.
Here are some things that could be improved:
stack init
currently refuses to create astack.yaml
when there's no cabal filestack build
could still build extra-deps.stack ghci file.hs
worked.stack exec ghci file.hs
works for me, but that's probably not obvious to a Haskell newcomer (and Haskell newcomers really need a simple way to run ghci)stack ghci
. I remember there wasstack dep
once, but it is no longer there.The text was updated successfully, but these errors were encountered: