In this episode, Wouter and Andres interview Ivan Perez, a senior research scientist at NASA. Ivan tells us about how NASA uses Haskell to develop the Copilot embedded domain specific language for runtime verification, together with some of the obstacles he encounters getting to end users to learn Haskell and adopt such an EDSL.
Around 29:15 @kosmikus suggest that it would be nice if there was a way to just specify dependencies without making a whole new cabal package which also requires filling out many more fields.
I think for that use-case we already have cabal scripts, e.g. put this at the top of your Main.hs
file:
{- cabal:
build-depends: base, copilot, copilot-c99
-}
And run your file with cabal run Main.hs
.
(It will take a while to compile all the dependencies and by default cabal will not print any info about the build, so you may want to add -v1
to give some indication of the progress.)
Or was it -v2-*
?
Stack also has a similar feature.
#!/usr/bin/env stack
-- stack --resolver lts-12.21 script
To address this, Stack has a script interpreter feature which allows these flags to be placed at the top of your script. Stack also has a dedicated
script
command which has some nice features like auto-detection of packages you need based on import statements.
Source: How to Script with Stack