root/src/Pugs/Embed/Haskell.hs

Revision 22990, 0.7 kB (checked in by audreyt, 9 days ago)

* GHC 6.10 support, part 3 of 3: Adjust for GADT's "rigid types" restriction.

  • Property svn:mime-type set to text/plain; charset=UTF-8
  • Property svn:eol-style set to native
Line 
1{-# OPTIONS_GHC -fglasgow-exts -cpp #-}
2
3module Pugs.Embed.Haskell where
4
5-- #include "../pugs_config.h"
6#if !defined(PUGS_HAVE_HSPLUGINS)
7
8import Pugs.AST
9
10evalHaskell :: String -> Eval Val
11evalHaskell _ = fail "need hs-plugins for eval_haskell"
12
13#else
14
15import qualified System.Eval
16import Pugs.AST
17
18evalHaskell :: String -> Eval Val
19evalHaskell code = do
20    let imports = []
21    -- eval_ code [import] [flags] [package.confs] [load paths]
22    --   -> IO (Either [error-strings] (Maybe a))
23    ret <- io $ System.Eval.eval_ code imports [] [] []
24    case ret of
25        Right (Just x) -> return $ VStr x
26        Right Nothing  -> fail "Something strange happened"
27        Left x         -> fail $ unlines x
28
29#endif
Note: See TracBrowser for help on using the browser.