packages feed

exploring-interpreters 0.3.0.0 → 0.3.1.0

raw patch · 5 files changed

+30/−7 lines, 5 filesPVP ok

version bump matches the API change (PVP)

API changes (from Hackage documentation)

+ Language.Explorer.Monadic: leaves :: Explorer p m c o -> [(Ref, c)]
+ Language.Explorer.Pure: leaves :: Explorer p c o -> [(Ref, c)]

Files

CHANGELOG.md view
@@ -1,8 +1,11 @@-# Revision history for exploring-interpreters +# Revision history for exploring-interpreters  ## 0.2.0.0 -- 2021-03-15-* First official version. +* First official version.  ## 0.3.0.0 -- 2021-03-16 * Require that definitional interpreters return configurations in the Maybe monad.   This adds support for run-time errors by returning Nothing when an errors occurs.++## 0.3.1.0 -- 2021-04-18+* This version adds the 'leaves' function to the exploring interpreter.
Language/Explorer/Basic.hs view
@@ -3,7 +3,7 @@     , execute     , executeAll     , revert-    , dynamicRevert +    , dynamicRevert     , ExplorerM.toTree     , mkExplorerStack     , mkExplorerTree@@ -13,6 +13,7 @@     , currRef     , Ref     , deref+    , leaves     , getTrace     , getTraces     , getPathsFromTo@@ -89,3 +90,6 @@ executionGraph e = (curr, nodes, map removeOutput graph)   where     (curr, nodes, graph) = ExplorerM.executionGraph e++leaves :: Explorer p c -> [(Ref, c)]+leaves = ExplorerM.leaves
Language/Explorer/Monadic.hs view
@@ -5,7 +5,7 @@     , execute     , executeAll     , revert-    , dynamicRevert +    , dynamicRevert     , toTree     , incomingEdges     , mkExplorerStack@@ -15,6 +15,7 @@     , config     , execEnv     , currRef+    , leaves     , Ref     , deref     , getTrace@@ -124,7 +125,7 @@ revert :: Ref -> Explorer p m c o -> Maybe (Explorer p m c o) revert r e = dynamicRevert (backTracking e) r e -  + toTree :: Explorer p m c o -> Tree (Ref, c) toTree exp = mkTree initialRef   where graph = execEnv exp@@ -180,3 +181,14 @@     curr = currRef exp     nodes = map fst (labNodes (execEnv exp))     edges = map (\(s, t, p) -> ((s, fromJust $ deref exp s), p, (t, fromJust $ deref exp t)) ) (labEdges (execEnv exp))++{-|+  Returns all configurations that have not been the source for an execute action.+  This corresponds to leaves in a tree or nodes without an outbound-edge in a graph.+-}+leaves :: Explorer p m c o -> [(Ref, c)]+leaves exp = map refToPair leave_nodes+  where+    env = execEnv exp+    refToPair = \r -> (r, fromJust $ deref exp r)+    leave_nodes = nodes $ nfilter (\n -> (==0) $ outdeg env n) env
Language/Explorer/Pure.hs view
@@ -3,7 +3,7 @@     , execute     , executeAll     , revert-    , dynamicRevert +    , dynamicRevert     , ExplorerM.toTree     , incomingEdges     , mkExplorerStack@@ -14,6 +14,7 @@     , currRef     , Ref     , deref+    , leaves     , getTrace     , getTraces     , getPathsFromTo@@ -80,3 +81,6 @@  executionGraph :: Explorer p c o -> (Ref, [Ref], [((Ref, c), (p, o), (Ref, c))]) executionGraph = ExplorerM.executionGraph++leaves :: Explorer p c o -> [(Ref, c)]+leaves = ExplorerM.leaves
exploring-interpreters.cabal view
@@ -1,7 +1,7 @@ cabal-version:       >=1.10  name:                exploring-interpreters-version:             0.3.0.0+version:             0.3.1.0 synopsis:            A generic exploring interpreter for exploratory programming -- synopsis: -- description: