haskell / haskell/stylish-haskell

Modules with Unsafe language pragmas can use "safe import"

Open
#149 3 comments 0 reactions 0 assignees View on GitHub
haskell-src-exts
Dominant language
Haskell
Stars
1k
Forks
153
PR merge metrics
No merged PRs in 30d

Description

If I use `stylish-haskell` on a module with
```
{-# LANGUAGE Unsafe #-} -- "import safe" is enforced
```
I still get the following error:
```
Language.Haskell.Stylish.Parse.parseModule: could not parse src/Extract/DefinitionsTheoremsLemmas.hs: ParseFailed (SrcLoc ".hs" 15 13) "At least one of Safe or SafeImports or Trustworthy language extensions needs to be enabled. Please add: {-# LANGUAGE Safe #-} or {-# LANGUAGE SafeImports #-} or {-# LANGUAGE Trustworthy #-} language pragma at the top of your module."
```
`Unsafe` is described [on the GHC wiki](https://ghc.haskell.org/trac/ghc/wiki/SafeHaskell).

Contributor guide

No contributing guide indexed for this repository

Research direction

Start at the mentioned entry point, Language.Haskell.Stylish.Parse.parseModule, and reproduce the failure with a module containing the shown Unsafe pragma, such as src/Extract/DefinitionsTheoremsLemmas.hs. Trace how the LANGUAGE pragmas are parsed; done means stylish-haskell accepts the module and handles its safe import correctly.

Written by the indexing model from the issue text.

Assessment

Tech stack
haskell
Domain
tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.