packages feed

egison 2.1.2 → 2.1.3

raw patch · 3 files changed

+37/−6 lines, 3 filesPVP ok

version bump matches the API change (PVP)

API changes (from Hackage documentation)

Files

egison.cabal view
@@ -1,5 +1,5 @@ Name:                egison-Version:             2.1.2+Version:             2.1.3 Synopsis:            An Interpreter for the Programming Language Egison Description:         An interpreter for the programming language Egison.                      A feature of Egison is the strong pattern match facility.
hs-src/Language/Egison/Core.hs view
@@ -15,7 +15,7 @@  -- |egison version number egisonVersion :: String-egisonVersion = "2.1.2"+egisonVersion = "2.1.3"  -- |A utility function to display the egison console banner showBanner :: IO ()@@ -152,9 +152,13 @@   case obj of -- for Macro expansion     Loop _ _ _ _ _ -> expandLoop env obj     _ -> return obj+cEval1 (Closure _ (InductiveDataExpr cons [])) = do+  return $ Value $ InductiveData cons [] cEval1 (Closure env (InductiveDataExpr cons argExprs)) = do   args <- liftIO $ mapM (makeClosure env) argExprs   return $ Intermidiate $ IInductiveData cons args+cEval1 (Closure _ (TupleExpr [])) = do+  return $ Value $ Tuple [] cEval1 (Closure env (TupleExpr innerExprs)) = do   innerRefs <- liftIO $ mapM (makeInnerValRef env) innerExprs   objRefs <- innerRefsToObjRefList innerRefs@@ -481,14 +485,16 @@   if (con == pcon)     then throwError (Default "inductiveMatch: not matched any clauses")     else inductiveMatch rest pcon tgtObjRefRef-inductiveMatch ((con,typObjRef,((env,ppat,expr):cls)):rest) pcon tgtObjRefRef =+inductiveMatch ((con,typObjRef,((env,ppat,expr):cls)):rest) pcon tgtObjRefRef = do   if (con == pcon)     then do mPpmRet <- primitivePatternMatch ppat tgtObjRefRef+                         case mPpmRet of               Nothing -> inductiveMatch ((con,typObjRef,cls):rest) pcon tgtObjRefRef-              Just ppmRet -> do newEnv <- liftIO $ extendEnv env ppmRet-                                ret <- liftIO $ makeClosure newEnv expr-                                return (typObjRef,ret)+              Just ppmRet -> do+                newEnv <- liftIO $ extendEnv env ppmRet+                ret <- liftIO $ makeClosure newEnv expr+                return (typObjRef,ret)     else inductiveMatch rest pcon tgtObjRefRef  @@ -529,6 +535,11 @@     Intermidiate (IInductiveData cons objRefs) ->       if pCons == cons         then primitivePatternMatchList pPats objRefs+        else return Nothing+    Value (InductiveData cons vals) ->+      if pCons == cons+        then do objRefs <- liftIO $ mapM (newIORef . Value) vals+                primitivePatternMatchList pPats objRefs         else return Nothing     _ -> return Nothing primitivePatternMatch PEmptyPat objRef = do
lib/core/base.egi view
@@ -4,6 +4,26 @@  (define $Something (type {[$var-match (lambda [$tgt] {tgt})]})) +(define $Bool+  (type+    {[$var-match (lambda [$tgt] {tgt})]+     [$inductive-match+      (destructor+        {[true []+          {[<true> {[]}]+           [#t {[]}]+           [_ {}]}]+         [false []+          {[<false> {[]}]+           [#f {[]}]+           [_ {}]}]})]+     [$=+      (lambda [$val $tgt]+        (match [val tgt] [Bool Bool]+          {[[<true> <true>] #t]+           [[<false> <false>] #t]+           [[_ _] #f]}))]}))+ (define $or   (lambda [$b1 $b2]     (if b1