Is it possible to specify an example of executable files for the library as optional in the cabal package?

those. this is not legal:

if someFlag {
  executable someExec {
  }
}

Is there any way to do this anyway? If not, is it appropriate to offer examples as a separate package for bondage?

+4
source share
2 answers

reactive-banana-wx does just that.

First define a flag:

flag buildExamples
    description: Build example executables
    default: False

Then, for each executable file, you can set buildable : falseit so as not to create it:

Executable Arithmetic
    if flag(buildExamples)
        build-depends: reactive-banana, wx, wxcore, base
    else
        buildable: False
    hs-source-dirs: src
    main-is: Arithmetic.hs
+4
source

I think you can use:

executable someExec
  if (someFlag)
    buildable: True
  else
    buildable: False
+2
source

Source: https://habr.com/ru/post/1529399/


All Articles