copilot-interpreter 3.20 → 4.0
raw patch · 3 files changed
+11/−5 lines, 3 filesdep ~copilot-corePVP ok
version bump matches the API change (PVP)
Dependency ranges changed: copilot-core
API changes (from Hackage documentation)
Files
- CHANGELOG +4/−0
- copilot-interpreter.cabal +2/−2
- src/Copilot/Interpret/Eval.hs +5/−3
CHANGELOG view
@@ -1,3 +1,7 @@+2024-09-07+ * Version bump (4.0). (#532)+ * Add support for array updates. (#36)+ 2024-07-07 * Version bump (3.20). (#522) * Add support for struct field updates. (#520)
copilot-interpreter.cabal view
@@ -1,6 +1,6 @@ cabal-version: >=1.10 name: copilot-interpreter-version: 3.20+version: 4.0 synopsis: Interpreter for Copilot. description: Interpreter for Copilot.@@ -44,7 +44,7 @@ base >= 4.9 && < 5, pretty >= 1.0 && < 1.2, - copilot-core >= 3.20 && < 3.21+ copilot-core >= 4.0 && < 4.1 exposed-modules:
src/Copilot/Interpret/Eval.hs view
@@ -19,8 +19,8 @@ import Copilot.Core (Expr (..), Field (..), Id, Name, Observer (..), Op1 (..), Op2 (..), Op3 (..), Spec, Stream (..), Trigger (..), Type (..), UExpr (..), Value (..),- arrayElems, specObservers, specStreams,- specTriggers, updateField)+ arrayElems, arrayUpdate, specObservers,+ specStreams, specTriggers, updateField) import Copilot.Interpret.Error (badUsage) import Prelude hiding (id)@@ -32,6 +32,7 @@ import Data.List (transpose) import Data.Maybe (fromJust) import Data.Typeable (Typeable)+import GHC.TypeLits (KnownNat, Nat, natVal) -- | Exceptions that may be thrown during interpretation of a Copilot -- specification.@@ -265,7 +266,8 @@ -- Haskell function operating on the same types as the -- 'Copilot.Core.Operators.Op3'. evalOp3 :: Op3 a b c d -> (a -> b -> c -> d)-evalOp3 (Mux _) = \ !v !x !y -> if v then x else y+evalOp3 (Mux _) = \ !v !x !y -> if v then x else y+evalOp3 (UpdateArray ty) = \xs n x -> arrayUpdate xs (fromIntegral n) x -- | Turn a stream into a key-value pair that can be added to an 'Env' for -- simulation.