copilot-core 3.4 → 3.5
raw patch · 5 files changed
+17/−70 lines, 5 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
Files
- CHANGELOG +8/−0
- README.md +1/−1
- copilot-core.cabal +5/−4
- src/Copilot/Core/Error.hs +1/−1
- src/Copilot/Core/Interpret/Eval.hs +2/−64
CHANGELOG view
@@ -1,3 +1,11 @@+2021-08-19+ * Version bump (3.5). (#247)+ * Update travis domain in README. (#222)+ * Remove commented code. (#15)+ * Update official maintainer. (#236)+ * Update source repo location. (#241)+ * Add I. Perez to author list. (#243)+ 2021-07-07 * Version bump (3.4). (#231) * Deprecated `Copilot.Core.Locals`. (#141)
README.md view
@@ -1,4 +1,4 @@-[](https://travis-ci.org/Copilot-Language/copilot-core)+[](https://travis-ci.com/Copilot-Language/copilot-core) # Copilot: a stream DSL The core language, which efficiently represents Copilot expressions. The core
copilot-core.cabal view
@@ -1,6 +1,6 @@ cabal-version: >=1.10 name: copilot-core-version: 3.4+version: 3.5 synopsis: An intermediate representation for Copilot. description: Intermediate representation for Copilot.@@ -13,10 +13,10 @@ <https://copilot-language.github.io>. author: Frank Dedden, Lee Pike, Robin Morisset, Alwyn Goodloe,- Sebastian Niller, Nis Nordbyop Wegmann+ Sebastian Niller, Nis Nordbyop Wegmann, Ivan Perez license: BSD3 license-file: LICENSE-maintainer: Frank Dedden <dev@dedden.net>+maintainer: Ivan Perez <ivan.perezdominguez@nasa.gov> homepage: https://copilot-language.github.io bug-reports: https://github.com/Copilot-Language/copilot/issues stability: Experimental@@ -26,7 +26,8 @@ source-repository head type: git- location: https://github.com/Copilot-Language/copilot-core.git+ location: https://github.com/Copilot-Language/copilot.git+ subdir: lib/copilot-core library
src/Copilot/Core/Error.hs view
@@ -18,7 +18,7 @@ ++ function ++ ", in package " ++ package ++ ". Please file an issue at " ++ "https://github.com/Copilot-Language/copilot/issues"- ++ "or email the maintainers at <dev@dedden.net>"+ ++ "or email the maintainers at <ivan.perezdominguez@nasa.gov>" -- | Report an error due to an error detected by Copilot (e.g., user error). badUsage :: String -- ^ Description of the error.
src/Copilot/Core/Interpret/Eval.hs view
@@ -8,8 +8,7 @@ {-# LANGUAGE GADTs, BangPatterns, DeriveDataTypeable #-} module Copilot.Core.Interpret.Eval- ( --ExtEnv (..)- Env+ ( Env , Output , ExecTrace (..) , eval@@ -34,15 +33,12 @@ -- | Exceptions that may be thrown during interpretation of a Copilot -- specification. data InterpException- = -- NoValues Name--- | BadType Name- ArrayWrongSize Name Int -- ^ Extern array has incorrect size.+ = ArrayWrongSize Name Int -- ^ Extern array has incorrect size. | ArrayIdxOutofBounds Name Int Int -- ^ Index out-of-bounds exception. | DivideByZero -- ^ Division by zero. | NotEnoughValues Name Int -- ^ For one or more streams, not enough -- values are available to simulate the -- number of steps requested.--- | NoExtFunEval Name | NoExtsInterp Name -- ^ One of the externs used by the -- specification does not declare -- sample values to be used during@@ -52,16 +48,6 @@ -- | Show a descriptive message of the exception. instance Show InterpException where ---------------------------------------- -- show (NoValues name) =- -- badUsage $ "you need to supply a list of values for interpreting "- -- ++ "external element " ++ name ++ "."- ----------------------------------------- -- -- Should always be caught by Analyze.hs in copilot-language.- -- show (BadType name) =- -- badUsage $ "you probably gave the wrong type for external element "- -- ++ name ++ ". Recheck your types and re-evaluate."- --------------------------------------- show (ArrayWrongSize name expectedSize) = badUsage $ "in the environment for external array " ++ name ++ ", we expect a list of length " ++ show expectedSize@@ -97,15 +83,6 @@ -- names and their values. type Env nm = [(nm, Dynamic)] --- -- | External arrays environment.--- type ArrEnv = [(Name, [DynamicF [] Type])]---- -- | Environment for simulation.--- data ExtEnv = ExtEnv { varEnv :: Env Name--- , arrEnv :: ArrEnv--- -- , funcEnv :: [(Name, Spec)]--- }- -------------------------------------------------------------------------------- -- | The simulation output is defined as a string. Different backends may@@ -129,22 +106,6 @@ -------------------------------------------------------------------------------- -{--eval :: Int -> Env Name -> Spec -> ExecTrace-eval k exts spec =- let- strms = fmap (evalStream exts strms) (specStreams spec)- trigs = fmap (evalTrigger k exts strms) (specTriggers spec)- obsvs = fmap (evalObserver k exts strms) (specObservers spec)- in- ExecTrace- { interpTriggers = M.fromList $- zip (fmap triggerName (specTriggers spec)) trigs- , interpObservers = M.fromList $- zip (fmap observerName (specObservers spec)) obsvs- }--}- -- We could write this in a beautiful lazy style like above, but that creates a -- space leak in the interpreter that is hard to fix while maintaining laziness. -- We take a more brute-force appraoch below.@@ -156,7 +117,6 @@ -> Spec -- ^ Specification to evaluate. -> ExecTrace eval showType k spec =--- let exts = take k $ reverse exts' in let initStrms = map initStrm (specStreams spec) in @@ -228,28 +188,6 @@ Just x -> x ------------------------------------------------------------------------------------ evalFunc :: Int -> Type a -> Name -> Expr a -> ExtEnv -> a--- evalFunc k t name expr exts =--- evalExpr k expr---- case lookup name (funcEnv exts) of--- Nothing -> throw (NoValues name)---- -- We created this spec in Interpreter.hs, copilot-language, so it should--- -- contain no triggers and exactly one observer.--- Just Spec { specStreams = specStrms--- , specObservers = obsLs } ->--- let initStrms = map initStrm specStrms in--- let strms = evalStreams k exts specStrms initStrms in--- case obsLs of--- [Observer { observerExpr = expr_--- , observerExprType = t1 }] ->--- let dyn = toDynF t1 expr_ in--- case fromDynF t dyn of--- Nothing -> throw (BadType name)--- Just expr -> evalExpr_ k expr exts [] strms--- _ -> throw (BadType name) --------------------------------------------------------------------------------