haskell-mode
haskell-mode copied to clipboard
Feature request: "cabal repl" with file target
trafficstars
I like to use "single cabal script" a lot for small examples, e.g.:
$ cat ~/Templates/cabalscript.hs:
#!/usr/bin/env cabal
{- cabal:
build-depends: base
-}
main = do
putStrLn "Hello World!"
_ <- readLn :: IO String
return ()
If one could test this by typing "C-c C-l" that'd grand, since cabal pull in all the dependencies encoded in the special comments area. ~~I suspect we need a new type for haskell-process-type?~~
~~Also any pointer to where to look at for start hacking on it?~~
Edit: I have found a workaround of using the filename itself as the cabal-repl target.
I found a workaround nonetheless:
#!/usr/bin/env cabal
{- cabal:
build-depends: base
default-language: GHC2021
-}
main = do
putStrLn "Hello World!"
_ <- readLn :: IO String
return ()
{-
Local Variables:
fill-column: 120
;; This will allow you to set the cabal-repl target to be this file directly.
haskell-process-type: cabal-repl
haskell-process-load-or-reload-prompt: t
End:
-}
With this, I would only need to do a couple of initial setup for the initial C-c C-l, and set the cabal repl target to the file name itself.