4 ms·
> I've been trying for the last 3 days to wrap my work style around cabal/stack... You have me puzzled! You can totally ignore/skip cabal and just use - to cr
by dualogy 10y ago
> I've been trying for the last 3 days to wrap my work style around cabal/stack...
You have me puzzled! You can totally ignore/skip cabal and just use
- to create project dir with stack.yaml
stack new myproject simple
- to ensure all dependencies and a ghc for that stack.yaml are present
stack setup
- to rebuild any changes
stack make
- to live-code in your project
stack repl
- to run interpreted any one of your mains:
stack runghc some/tool.hs
- to grab 3rd-party dependencies for the project:
stack install some-external-lib
Pretty similar to most other modern languages' "canonical" build/run/package-management tooling really.
> Ideally, I'd be able to write Haskell that compiles into concise, trimmed down, readable javascript bundles, (as you can compile OCaml with bucklescript). But I don't think it's really possible right now. Once upon a time I successfully managed to get ghcjs to compile code using a library I was interested in. It spit out a 1 MB bundle, without even doing much of anything.
Well. For JavaScript from Haskell, other than GHCJS that "compiles the whole runtime system" to multi-MB packages, there's more lightweight options (outside of PureScript/Elm), namely: Fay and Haste. Fear not, a new from-scratch transpiler is also next on my agenda however! ;) that's because Fay parses Haskell to transpile, but I definitely want to transpile from the highly optimized and richly annotated-with-compilation-hints "STG" IR. Not sure how Haste does it, but I'd rather have full control over the JS I emit over the coming half-decade anyway and it's certainly a bit dated (ES 6+ can be emitted so much more "compactly" than legacy JS!)
That being said, from what you're saying I think you're better served with ReasonML or PureScript as these projects seem to already have matured somewhat yet also not-yet-stale =)
- macawfish 10y agoThanks for the tips! I guess some of my frustration was that I was trying to get haste running with stack, but it needs ghc v7-something, but I'm getting ghc from pacman, so stack kept asking me to manually resolve libraries... there were other dramas and confusions too, but mostly I have little patience for making package managers play nicely, especially when I'm not very familiar with them in the first place and am new to the language! I get distracted and go off to play piano or something that's more straightforward to me :)
- mrkgnao 10y agoIt's better to use stack --install-ghc $whatever_command which gets you the version of GHC you need to be able to run $whatever_command into ~/.stack if you don't have it. Much less brittle than a system-wide installation, and perfect for working with multiple GHCs. Anecdotally: I setup the Arch Linux machine I'm typing this on yesterday. I installed[1] Stack/GHC before xorg :) [1]: It was so that I could run Aura: https://github.com/aurapm/aura https://github.com/aurapm/aura