haskell / haskell/haskell-mode
Getting exposed modules
- Dominant language
- Emacs Lisp
- Stars
- 1.4k
- Forks
- 354
- Avg merge
- 5d 10h
- Merged PRs (30d)
- 2
Description
In `haskell-session-installed-modules`, there's an [egrep command](https://github.com/haskell/haskell-mode/blob/master/haskell-modules.el#L77) that's meant to get the exposed-modules from `ghc-pkg dump`. Unfortunately, it doesn't seem to always work due to the uncertain formatting.
For example, I have the following output from `ghc-pkg dump`:
```
...
exposed-modules:
Data.IntMap Data.IntMap.Lazy Data.IntMap.Strict Data.IntSet
Data.Map Data.Map.Lazy Data.Map.Strict Data.Set Data.Graph
Data.Sequence Data.Tree
...
```
Note that there are only four spaces there, not 17 as expected; it seems that when this was written `ghc-pkg dump` would format the output such that the first module was listed after `exposed-modules:` and then others would be indented to start at the same column.
I'm not sure if using `egrep` is the correct approach here: it might need to be a matter of dropping lines until one starting with `exposed-modules:` is reached, taking lines that are space-indented and then repeating until end of input is reached.
Contributor guide
Assessment
This issue has not been assessed yet.