Fixes to use $fptools-compatible Dynamic

This commit is contained in:
Don Stewart
2005-05-19 03:24:30 +00:00
parent 6045e47850
commit ff2a96c13d
6 changed files with 36 additions and 47 deletions

View File

@ -10,25 +10,26 @@
#include "../../../config.h"
import System.Eval.Haskell
import System.Eval
import AltData.Dynamic
-- import Data.Dynamic
pkgconf = TOP ++ "/plugins.conf.inplace"
main = do
a <- return $ toDyn (3::Int)
m_b <- unsafeEval_ "\\dyn -> fromMaybe (7 :: Int) (fromDyn dyn)"
["AltData.Dynamic","Data.Maybe"] -- imports
a <- return $ toDyn (3::Integer)
-- so, we try to compile a function that takes a dyn.
-- looks like with GHC 6.4, we need to make sure the package.confs work:
m_b <- unsafeEval_ "\\dyn -> fromDyn dyn (7 :: Integer)"
["AltData.Dynamic"]
[ "-package-conf "++pkgconf , "-package altdata" ]
[ pkgconf ]
[]
case m_b of
Left s -> mapM_ putStrLn s
Right b -> putStrLn $ show (b a :: Integer) -- now apply it
{-
-- should work, but doesn't. type check fails
-- (due to static vs dynamic typing issue)
@ -37,6 +38,3 @@ main = do
["Data.Dynamic","Data.Maybe"] [] []
-}
case m_b of
Left s -> mapM_ putStrLn s
Right b -> putStrLn $ show (b a :: Int)