What does "instance [safe]" mean in ghci ": info" output?

In ghciI declare a data type as follows.

data Example = MakeExample deriving Show

Then, when I call :info Exampleto find out that the derived instance is Showrecognized, I get the following output.

> :i Example
data Example = MakeExample      -- Defined at <interactive>:17:1
instance [safe] Show Example -- Defined at <interactive>:17:37

The instance is Showrecognized as expected. However, I do not understand why this is [safe].

In contrast, it [safe]does not appear when I call :infoon Bool.

> :i Bool
data Bool = False | True        -- Defined in ‘GHC.Types’
instance Bounded Bool -- Defined in ‘GHC.Enum’
instance Enum Bool -- Defined in ‘GHC.Enum’
instance Eq Bool -- Defined in ‘GHC.Classes’
instance Ord Bool -- Defined in ‘GHC.Classes’
instance Read Bool -- Defined in ‘GHC.Read’
instance Show Bool -- Defined in ‘GHC.Show’

What does instance [safe]the conclusion mean ghci :info?

+4
source share

Source: https://habr.com/ru/post/1686161/


All Articles