haskell / haskell/cabal

Feature request: provide text of LICENSE file as String/Text in generated Paths_XYZ

Open
#7,173 3 comments 0 reactions 0 assignees View on GitHub
re: installed-package-info
Dominant language
Haskell
Stars
1.7k
Forks
750
Avg merge
4d 3h
Merged PRs (30d)
28

Description

The cabal-generated `Paths_XYZ` gives me all kind of useful values from the installation, but not the text of the `LICENSE` file.

Feature: provide a def `license :: Text` in `Paths_XYZ` containing the text of `LICENSE`.

My current workaround is: Put a `Makefile` in the `src` directory that creates `License.hs`:
```make
License.hs : ../LICENSE Makefile
echo "\
-- This file was autogenerated from LICENSE, do not edit!!\n\n\
{-# LANGUAGE QuasiQuotes #-}\n\n\
module License where\n\n\
import Data.String.QQ\n\n\
license :: String\n\
license = [s|" > $@
cat $< >> $@
echo "\n|]" >> $@
```
Then I add `License` to the module list in the cabal file and can `import License` in my executable.

However, this boilerplate would not be necessary if `license` was declared in `Paths_XYZ`.

Related feature request: #4887, but mine is more modest and has a straightforward semantics.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.