use data-files without installation

Henning Thielemann lemming at henning-thielemann.de
Fri Mar 3 10:02:30 UTC 2017


In a project I have currently some program text embedded as String in the 
source code. I like to move that to an extra file, such that I can test 
the program without running the Haskell code and such that non-Haskell 
programmers can adapt the text. However, I hesitate to use the Data-Files 
feature of Cabal since this would mean that I can test the Haskell code 
only after installation of the whole Cabal package including the text 
file.

Is there a way to use 'cabal repl' with the local version of the text 
file? This would mean there must be a different variant 
autogen/Paths_mod.hs, maybe the same file name but in a different 
directory that is only passed to GHCi by 'cabal repl'. Manageable but 
certainly surprising? Maybe only available by a new option like 'cabal 
repl --local-dirs'.

More difficult: Can even 'cabal build' incl. dist/build/prog/prog and 
'cabal run' use local data files per request? Certainly not, since 
dist/build/prog/prog shall just be installed by 'cabal install'.

Alternatively, is there a way to tell GHC to include a file in the 
executable and provide access to its content? Would there be support in 
Cabal for this feature?


More information about the cabal-devel mailing list