github.com/joey-fossa/fossa-cli@v0.7.34-0.20190708193710-569f1e8679f0/docs/integrations/haskell.md (about) 1 # Haskell 2 3 ## Support 4 5 Haskell support in FOSSA CLI depends on one of following tools existing in your 6 environment: 7 8 - cabal-install (aka `cabal`), version 2.0 or newer 9 - `stack` 10 11 cabal-install is recommended. 12 13 ## Configuration 14 15 ### Automatic 16 17 Run `fossa init`, which detects: 18 19 - cabal projects, via `cabal.project` and `*.cabal` 20 - stack projects, via `stack.yaml` 21 22 Refer to [Discovery](#Discovery) for more information on the auto-configuration 23 logic. 24 25 ### Manual 26 27 Add a module with `type: haskell`, and `target`+`path` set to the directory 28 containing the top-level project (usually the directory containing a 29 `cabal.project` or `stack.yaml`). 30 31 Additionally, configure the relevant strategy (either `cabal-install` or 32 `stack`). See example below. 33 34 ```yaml 35 analyze: 36 modules: 37 - name: lens 38 type: haskell 39 target: . 40 path: . 41 options: 42 strategy: cabal-install 43 ``` 44 45 ## Options 46 47 | Option | Type | Name | Description | 48 | ---------- | :----: | ---------------------------- | ---------------------------------------------------------------------------------------- | 49 | `strategy` | string | [Strategy](#strategy-string) | Used to specify the build tool used for this project (either `cabal-install` or `stack`) | 50 51 52 #### `strategy: <string>` 53 54 Used to specify the build tool used for this project. Can be one of: 55 56 - `cabal-install` 57 - `stack` 58 59 ## Discovery 60 61 Haskell discovery traverses the filetree, looking for `cabal.project`, 62 `stack.yaml`, and `*.cabal` files. 63 64 Because cabal and stack projects point to individual `*.cabal` files, we remove 65 `*.cabal` entries in a deduplication pass: `*.cabal` files with a project file 66 in the current or any parent directory won't be included in the final output. 67 68 ## Analysis 69 70 Analysis differs for each of the build tools. 71 72 ### cabal-install 73 74 Projects defined in `cabal.project` and standalone `*.cabal` packages are 75 analyzed the same way. 76 77 1. A solver plan (from `cabal new-build`) is generated if it doesn't already 78 exist via `cabal v2-build --dry-run` 79 80 2. The solver plan is analyzed and its dependency graph extracted (from `dist-newstyle/cache/plan.json`) 81 82 > note: analysis will fail if a solver plan doesn't exist and isn't able to be 83 generated. It's best to build the project before running `fossa analyze` 84 85 ### stack 86 87 The stack analyzer builds out the dependency graph for a project using: 88 89 1. The list of all dependencies (both direct and transitive) via `stack ls dependencies` 90 2. The list of direct dependencies via `stack ls dependencies --depth 1` 91 3. The global dependency graph from ghc-pkg with `stack exec -- ghc-pkg dot` 92 93 ## FAQ 94 95 ### Q: Why isn't my stack project showing all of its dependencies? 96 97 Make sure to build your project first, then run `fossa analyze`. This ensures 98 the dependencies are available for analysis 99 100 ### Q: Why are my projects appearing as dependencies of themselves? 101 102 This is a side effect of the way cabal (the library) structures 103 library+executable projects. You can safely ignore those references, and 104 they won't affect the output of analysis.