stylish-haskell icon indicating copy to clipboard operation
stylish-haskell copied to clipboard

Modules with Unsafe language pragmas can use "safe import"

Open langston-barrett opened this issue 7 years ago • 3 comments

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.

langston-barrett avatar Jan 19 '17 23:01 langston-barrett

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

jaspervdj avatar Jan 24 '17 12:01 jaspervdj

Reported upstream

langston-barrett avatar Jan 24 '17 22:01 langston-barrett

An example for future reference:

{-# LANGUAGE Unsafe #-}

module Main where

import safe Safe

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

neongreen avatar Apr 15 '17 19:04 neongreen