Changeset 2029

Show
Ignore:
Timestamp:
04/16/05 15:30:17 (4 years ago)
Author:
theorbtwo
svk:copy_cache_prev:
3535
Message:

eval_haskell -- must return a Char at present. (Should be string, don't know why it's not...)

Files:
3 modified

Legend:

Unmodified
Added
Removed
  • Makefile.PL

    r2010 r2029  
    5656 
    5757    my ($ghc, $ghc_version, $ghc_flags) = assert_ghc(); 
    58     # $ghc_flags .= ' -dcore-lint -ignore-package eval-0.9.8'; 
     58    # $ghc_flags .= ' -dcore-lint'; 
     59    $ghc_flags .= " -keep-tmp-files"; 
    5960        if (!has_ghc_package('plugins')) { 
    6061          warn << '.'; 
  • src/Pugs/Embed.hs

    r2009 r2029  
    1212module Pugs.Embed ( 
    1313    module Pugs.Embed.Perl5, 
    14     -- module Pugs.Embed.Haskell 
     14    module Pugs.Embed.Haskell 
    1515    -- module Pugs.Embed.Parrot 
    1616    -- module Pugs.Embed.Ponie 
    1717) where 
    1818import Pugs.Embed.Perl5 
    19 -- import Pugs.Embed.Haskell 
     19import Pugs.Embed.Haskell 
    2020-- import Pugs.Embed.Parrot 
    2121-- import Pugs.Embed.Ponie 
  • src/Pugs/Prim.hs

    r2024 r2029  
    201201    opEval False "<eval>" str 
    202202op1 "eval_perl5" = boolIO evalPerl5 
     203op1 "eval_haskell" = op1EvalHaskell 
    203204op1 "defined" = op1Cast (VBool . defined) 
    204205op1 "last" = \v -> return (VError "cannot last() outside a loop" (Val v)) 
     
    375376op1 "log10" = op1Cast (VNum . logBase 10) 
    376377op1 other   = return . (\x -> VError ("unimplemented unaryOp: " ++ other) (App other [Val x] [])) 
     378 
     379op1EvalHaskell :: Val -> Eval Val 
     380op1EvalHaskell cv = do 
     381    cstr <- (fromVal cv) :: Eval String 
     382    retstr <- liftIO (evalHaskell cstr) 
     383    return $ VStr $ retstr 
    377384 
    378385op1Cast :: (Value n) => (n -> Val) -> Val -> Eval Val 
     
    611618    then op2Num (**) x y 
    612619    else op1Cast (VNum . exp) x 
     620-- FIXME: Generalize to N args for arb N?  Is this possible? 
    613621op2 "sprintf" = \x y -> do 
    614622    str  <- fromVal x 
     
    12351243\\n   Str       pre     perl    (rw!Any)\ 
    12361244\\n   Any       pre     eval    (Str)\ 
    1237 \\n   Any       pre     eval_perl5 (Str)\ 
     1245\\n   Any       pre     eval_perl5   (Str)\ 
     1246\\n   Any       pre     eval_haskell (Str)\ 
    12381247\\n   Any       pre     require (?Str=$_)\ 
    12391248\\n   Any       pre     require_haskell (Str)\