What does the [secure] marker in ghci mean?

Prelude Data.Void> :info Void data Void -- Defined in `Data.Void' instance [safe] Eq Void -- Defined in `Data.Void' instance [safe] Ord Void -- Defined in `Data.Void' instance [safe] Read Void -- Defined in `Data.Void' instance [safe] Show Void -- Defined in `Data.Void' 

What does [safe] mean?

+5
source share
1 answer

It simply means that the data type is defined in the module, which is defined using secure extension. Details of the extension in the user guide .

In fact, you can verify this yourself by specifying a module with the Safe extension:

 {-#LANGUAGE Safe#-} data Test = Test deriving (Eq, Show) 

And then try in ghci :

 λ> :i Test data Test = Test instance [safe] Eq Test instance [safe] Show Test 

But note that in the current GHC (7.10.2), a secure extension cannot rely on a guarantee of trust due to this ghc error .

+4
source

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


All Articles