packages feed

phino 0.0.126 → 0.0.127

raw patch · 3 files changed

+42/−6 lines, 3 filesPVP ok

version bump matches the API change (PVP)

API changes (from Hackage documentation)

Files

phino.cabal view
@@ -1,6 +1,6 @@ cabal-version: 3.0 name: phino-version: 0.0.126+version: 0.0.127 license: MIT synopsis: Command-Line Manipulator of 𝜑-Calculus Expressions description: Please see the README on GitHub at <https://github.com/objectionary/phino#readme>
src/Dataize.hs view
@@ -660,7 +660,12 @@ -- 'ReduceFunc' in 'Atoms'): the expression is bound to a synthetic attribute -- of the universe and dataized there, exactly the way the '--inside' option -- does it, so the bytes come back as a Δ formation — or, where an atom on the--- way could not fire and '_partial' parked it, the residual program instead.+-- way could not fire and '_partial' parked it, the node the question named,+-- taken out of the residue at the synthetic attribute. The residue is the whole+-- synthetic universe, and answering with it hands the program a print of the+-- universe per question, thousands of bytes around the one node it asked about+-- (#1167); nothing is lost by trimming it, since the rest of that residue is+-- the universe the program was already told under '𝑒'. -- An operand reaches a program unreduced, since reducing it may take the very -- atom being fired, and before the channel carried questions the program had -- no way to ask: it had to splice the operand into the text of the universe@@ -670,11 +675,11 @@ reduction univ ctx expr = do   (universe, aiming) <- insideUniverse expr univ ctx   (outcome, _) <- dataize universe aiming-  pure (reduced outcome)+  reduced aiming._locator outcome   where-    reduced :: Outcome -> Expression-    reduced (Dataized bytes) = ExFormation [BiDelta bytes]-    reduced (Residual residue) = residue+    reduced :: Expression -> Outcome -> IO Expression+    reduced _ (Dataized bytes) = pure (ExFormation [BiDelta bytes])+    reduced locator (Residual residue) = locatedExpression locator residue  -- phino implements no λ function of its own. Which atoms exist is a property of -- the object model being dataized, not of the calculus, so they come from the
test/CLISpec.hs view
@@ -136,6 +136,26 @@ withLoopingAsk :: (String -> Expectation) -> Expectation withLoopingAsk action = withNode (withLoopingAskRegistry (action . ("--atoms=" ++))) +-- A resident program that cannot answer its request before phino reduces+-- 'Q.nope' for it, a dispatch on an atom the registry does not carry and+-- '--partial' parks: it answers 'FF-' when phino said the parked node back+-- alone and '00-' when the answer carried the whole universe that node was+-- reduced inside, which the other atom of the universe is named in+parking :: T.Text+parking =+  T.pack $+    unlines+      [ "printf '{\"id\": 7, \"ask\": \"Q.nope\"}\\n'"+      , "IFS= read -r reply"+      , "case \"$reply\" in"+      , "  *L_answer*) " ++ answering "00-" ++ ";;"+      , "  *) " ++ answering "FF-" ++ ";;"+      , "esac"+      ]+  where+    answering :: String -> String+    answering bytes = "printf '{\"id\": %s, \"𝑛\": \"⟦ Δ ⤍ " ++ bytes ++ " ⟧\"}\\n' \"$id\""+ testCLIFailed :: [String] -> [String] -> Expectation testCLIFailed args outputs = testCLI' args outputs (Left (ExitFailure 1)) @@ -1370,6 +1390,17 @@             testCLISucceeded               ["dataize", atoms, "--partial", "--max-steps=200"]               ["2A-"]++      -- A question is answered with the node the program asked about, and+      -- never with the universe that node was reduced inside: a parked+      -- question used to hand the residue back whole, so a program reading a+      -- seventeen-byte node paid for a print of the entire universe, once per+      -- question (#1167)+      it "answers a parked question with the node alone" $+        withShell $+          withServing parking $ \registry ->+            withStdin "⟦ nope ↦ ⟦ λ ⤍ L_nope ⟧, φ ↦ ⟦ λ ⤍ L_answer ⟧ ⟧" $+              testCLISucceeded ["dataize", "--atoms=" ++ registry, "--partial"] ["FF-"]        -- Without '--partial' the exhausted budget fails the run through a       -- question just as it fails it anywhere else (#1052's message)