Up until recently, I was executing this beauty to build + run a project with stack:
stack build && .stack-work/install/x86_64-linux/lts-4.1/7.10.3/bin/<project-name>
I was told on IRC that this can be simplified to
stack build && stack exec <project-name>
Can this be simplified even more, to
stack run
or at least
stack run <project-name>
?
If I recall correctly this was possible with cabal run
.
Edit:
@haoformayor's comment is getting close:
alias b='stack build --fast --ghc-options="-Wall" && stack exec'
Although this still needs the project name, right?
I've also started to get close with
function stack-run () { stack build && stack exec `basename "$PWD"` }
Although this only works if the project name matches with the folder name. Maybe we can query cabal/stack for the first executable
entry in the .cabal file? Or Maybe we could do it with sed
...