If you declare a library + executable sections in a cabal file while avoiding double compilation of the library by putting the library into a hs-source-dirs dir
You can use cabal repl to start ghci with the configuration from the cabal file and cabal run to compile and run the executables. Unlike runhaskell and ghci, using cabal repl and cabal run also picks up dependencies from cabal sandboxes correctly.