Take a relative file path and attach it to the root of the current
project.
The idea here is that, when building with Stack, the build will always
be executed with a current working directory of the root of the
project (where your .cabal file is located). However, if you load up
multiple projects with
stack ghci, the working directory may
be something else entirely.
This function looks at the source location of the Haskell file calling
it, finds the first parent directory with a .cabal file, and uses that
as the root directory for fixing the relative path.
$(makeRelativeToProject "data/foo.txt" >>= embedFile)