aboutsummaryrefslogtreecommitdiffhomepage
path: root/plugins/extraction/haskell.ml
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/extraction/haskell.ml')
-rw-r--r--plugins/extraction/haskell.ml13
1 files changed, 10 insertions, 3 deletions
diff --git a/plugins/extraction/haskell.ml b/plugins/extraction/haskell.ml
index 5f31edfb6..37b414207 100644
--- a/plugins/extraction/haskell.ml
+++ b/plugins/extraction/haskell.ml
@@ -52,15 +52,23 @@ let preamble mod_name comment used_modules usf =
str "import qualified Prelude" ++ fnl () ++
prlist pp_import used_modules ++ fnl () ++
(if List.is_empty used_modules then mt () else fnl ()) ++
- (if not usf.magic then mt ()
+ (if not (usf.magic || usf.tunknown) then mt ()
else str "\
\n#ifdef __GLASGOW_HASKELL__\
\nimport qualified GHC.Base\
+\nimport qualified GHC.Prim\
+\n#else\
+\n-- HUGS\
+\nimport qualified IOExts\
+\n#endif" ++ fnl2 ())
+ ++
+ (if not usf.magic then mt ()
+ else str "\
+\n#ifdef __GLASGOW_HASKELL__\
\nunsafeCoerce :: a -> b\
\nunsafeCoerce = GHC.Base.unsafeCoerce#\
\n#else\
\n-- HUGS\
-\nimport qualified IOExts\
\nunsafeCoerce :: a -> b\
\nunsafeCoerce = IOExts.unsafeCoerce\
\n#endif" ++ fnl2 ())
@@ -68,7 +76,6 @@ let preamble mod_name comment used_modules usf =
(if not usf.tunknown then mt ()
else str "\
\n#ifdef __GLASGOW_HASKELL__\
-\nimport qualified GHC.Prim\
\ntype Any = GHC.Prim.Any\
\n#else\
\n-- HUGS\