6.3.3. Safe imports

Safe
Since:7.2.1

Declare the Safe Haskell state of the current module.

Trustworthy
Since:7.2.1

Declare the Safe Haskell state of the current module.

Unsafe
Since:7.4.1

Declare the Safe Haskell state of the current module.

With the Safe, Trustworthy and Unsafe language flags, GHC extends the import declaration syntax to take an optional safe keyword after the import keyword. This feature is part of the Safe Haskell GHC extension. For example:

import safe qualified Network.Socket as NS

would import the module Network.Socket with compilation only succeeding if Network.Socket can be safely imported. For a description of when a import is considered safe see Safe Haskell.