Harvey Adcock
Harvey Adcock

Reputation: 971

Using modules that are "unsafe" in Haskell

How do you import modules that cause the ghci compiler to fail to compile due to them being safe? I'm trying to use Debug.Trace but I'm being told by the compiler it's unsafe.

Upvotes: 1

Views: 224

Answers (1)

Michael
Michael

Reputation: 2909

Does the module you are compiling have a {-# LANGUAGE Safe #-} pragma at the top? Certainly this can't be followed by import Debug.Trace. If not, could it be that -XSafe is being used somewhere else, e.g. in the way you are calling ghci? Also, unSafeness is supposed to be recursive, so if you are compiling a module that has {-# LANGUAGE Safe #-} but imports the module you are modifying, there will similarly be trouble.

Upvotes: 3

Related Questions