haskell / stylish-haskell

Haskell code prettifier
Other
987 stars 151 forks source link

Modules with Unsafe language pragmas can use "safe import" #149

Open langston-barrett opened 7 years ago

langston-barrett commented 7 years ago

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 "<unknown>.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.

jaspervdj commented 7 years ago

This depends on haskell-src-exts supporting the pragma.

langston-barrett commented 7 years ago

Reported upstream

neongreen commented 7 years ago

An example for future reference:

{-# LANGUAGE Unsafe #-}

module Main where

import safe Safe

main :: IO ()
main = putStrLn "Hello, World!"