In ghci
I declare a data type as follows.
data Example = MakeExample deriving Show
Then, when I call :info Example
to find out that the derived instance is Show
recognized, 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 Show
recognized as expected. However, I do not understand why this is [safe]
.
In contrast, it [safe]
does not appear when I call :info
on 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
?
source
share