How to qualify names in export list?
- LucianoOP 2
I have the following module definition:
module Observation (Observation, pure) where import Prelude hiding (pure) pure = ...This won’t compile; it complains about
purebeing ambiguous, as it appears in thePreludealso.Is there any way I can explicitly refer to the current module to include this in the exports lists?
I tried moving the
importup, but it appears the first directive expected ismodule. - bernhard 2
Your problem is that
Preludeis always imported in full.import Prelude hiding (pure)doesn’t hide the implicit import ofPrelude.You can use the language extension
NoImplicitPreludeto remove the implicit import, which should make your code compile. But think carefully about doing so. Messing withPreludemakes your code inherently harder to read for anyone else.Note also that language extensions like this are not really “supported” by DAML. They work by virtue of the GHC compiler frontend, which the DAML compiler uses. We don’t test that they work well, so code using such extensions may break without warning.