packages feed

copilot-language 3.4 → 3.5

raw patch · 10 files changed

+25/−153 lines, 10 filesdep −ghc-primdep ~copilot-coredep ~copilot-theoremPVP ok

version bump matches the API change (PVP)

Dependencies removed: ghc-prim

Dependency ranges changed: copilot-core, copilot-theorem

API changes (from Hackage documentation)

Files

CHANGELOG view
@@ -1,3 +1,13 @@+2021-08-19+        * Version bump (3.5). (#247)+        * Update travis domain in README. (#222)+        * Remove ghc-prim dependency from copilot-language. (#220)+        * Remove commented code. (#15)+        * Deprecate structArg. (#111)+        * Update source repo location. (#241)+        * Deprecate module Copilot. (#107)+        * Add I. Perez to author list. (#243)+ 2021-07-07         * Version bump (3.4). (#231) 
README.md view
@@ -1,4 +1,4 @@-[![Build Status](https://travis-ci.org/Copilot-Language/copilot.svg?branch=master)](https://travis-ci.org/Copilot-Language/copilot-core)+[![Build Status](https://travis-ci.com/Copilot-Language/copilot.svg?branch=master)](https://travis-ci.com/Copilot-Language/copilot-core)  # Copilot: a stream DSL Copilot-language contains the actual embedded domain specific language that
copilot-language.cabal view
@@ -1,6 +1,6 @@ cabal-version:       >=1.10 name:                copilot-language-version:             3.4+version:             3.5 synopsis:            A Haskell-embedded DSL for monitoring hard real-time                      distributed systems. description:@@ -16,8 +16,8 @@ license:             BSD3 license-file:        LICENSE author:              Frank Dedden, Lee Pike, Robin Morisset, Alwyn Goodloe,-                     Sebastian Niller, Nis Nordby Wegmann-maintainer:          Frank Dedden <dev@dedden.net>+                     Sebastian Niller, Nis Nordby Wegmann, Ivan Perez+maintainer:          Ivan Perez <ivan.perezdominguez@nasa.gov> homepage:            https://copilot-language.github.io bug-reports:         https://github.com/Copilot-Language/copilot/issues stability:           Experimental@@ -28,6 +28,7 @@ source-repository head     type:       git     location:   https://github.com/Copilot-Language/copilot.git+    subdir:     lib/copilot-language  library   default-language: Haskell2010@@ -38,10 +39,9 @@                , containers      >= 0.4 && < 0.7                , data-reify      >= 0.6 && < 0.7                , mtl             >= 2.0 && < 3-               , ghc-prim        >= 0.3 && < 0.7 -               , copilot-core    >= 3.4 && < 3.5-               , copilot-theorem >= 3.4 && < 3.5+               , copilot-core    >= 3.5 && < 3.6+               , copilot-theorem >= 3.5 && < 3.6    exposed-modules: Copilot                  , Copilot.Language
src/Copilot.hs view
@@ -5,6 +5,7 @@ {-# LANGUAGE Safe #-}  module Copilot+  {-# DEPRECATED "This module is deprecated." #-}   ( module Copilot.Language   ) where 
src/Copilot/Language/Analyze.hs view
@@ -241,17 +241,15 @@                       , externStructEnv  = datastructs                       , externStructArgs = struct_args }     = do-    -- symbol names redeclared?     findDups vars arrs-    --findDups vars struct_args+     findDups vars datastructs-    --findDups arrs struct_args+     findDups arrs datastructs-    -- conflicting types?+     conflictingTypes vars     conflictingTypes arrs-    -- symbol names given different number of args and right types?-    --funcArgCheck struct_args+     funcArgCheck struct_args    where@@ -288,10 +286,6 @@                                         -- result                else throw (BadFunctionArgType name)         else throw (BadNumberOfArgs name)--  {-structArgCheck :: [(String, [C.SimpleType])] -> IO ()-  structArgCheck ls = foldr (\sarg' _ -> findDups (getArgName sarg', sarg') (getArgName sarg', sarg'))-                        (return ()) $ map snd ls-}    groupByPred :: [(String, a)] -> [[(String, a)]]   groupByPred = groupBy (\(n0,_) (n1,_) -> n0 == n1)
src/Copilot/Language/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/Language/Interpret.hs view
@@ -12,45 +12,17 @@ {-# LANGUAGE GADTs, FlexibleInstances #-}  module Copilot.Language.Interpret-  ( --Input-    csv+  ( csv   , interpret---  , var---  , array---  , func   ) where ---import Copilot.Core.Type (Typed, typeOf)---import Copilot.Core.Interpret (ExtEnv (..))---import Copilot.Core.Type.Dynamic (toDynF) import qualified Copilot.Core.Interpret as I  import Copilot.Language.Spec (Spec) import Copilot.Language.Reify ---import Data.List (foldl')- -------------------------------------------------------------------------------- --- data Input where---   -- External variables.---   Var  :: Typed a => String -> [a] -> Input---   -- External arrays (list of lists).---   Arr  :: Typed a => String -> [[a]] -> Input---   -- -- External functions (streams).---   -- Func :: Typed a => String -> Stream a -> Input---- var :: Typed a => String -> [a] -> Input--- var = Var---- array :: Typed a => String -> [[a]] -> Input--- array = Arr---- func :: Typed a => String -> Stream a -> Input--- func = Func----------------------------------------------------------------------------------- -- | Simulate a number of steps of a given specification, printing the results -- in a table in comma-separated value (CSV) format. csv :: Integer -> Spec -> IO ()@@ -73,37 +45,6 @@ interpret' :: I.Format -> Integer -> Spec -> IO () interpret' format i spec = do   coreSpec <- reify spec---  fexts    <- funcExts   putStrLn $ I.interpret format (fromIntegral i) coreSpec----  where---   unionExts :: ExtEnv---   unionExts = ExtEnv { varEnv  = varEnv varArrExts---                      , arrEnv  = arrEnv varArrExts--- --                     , funcEnv = fexts---                      }--  -- -- We do the two folds below over the data type separately, since one-  -- -- component is monadic.-  -- funcExts :: IO [(Name, C.Spec)]-  -- funcExts =-  --   let (names, specs) = unzip $ foldl' envf [] inputs in-  --   do ss <- sequence specs-  --      return $ zip names ss-  --   where-  --   envf :: [(Name, IO C.Spec)] -> Input -> [(Name, IO C.Spec)]-  --   envf acc (Func name strm) =-  --     (name, reify $ observer name strm) : acc-  --   envf acc _ = acc--  -- varArrExts :: ExtEnv-  -- varArrExts = foldl' env (ExtEnv [] []) inputs-  --   where-  --   env :: ExtEnv -> Input -> ExtEnv-  --   env acc (Var name xs) =-  --     acc { varEnv = (name, toDynF typeOf xs) : varEnv acc }-  --   env acc (Arr name xs) =-  --     acc { arrEnv = (name, map (toDynF typeOf) xs) : arrEnv acc }---    env acc _ = acc  --------------------------------------------------------------------------------
src/Copilot/Language/Reify.hs view
@@ -15,7 +15,6 @@ import qualified Copilot.Core as Core import Copilot.Core (Typed, Id, typeOf, impossible) ---import Copilot.Language.Reify.Sharing (makeSharingExplicit) import Copilot.Language.Analyze (analyze) import Copilot.Language.Spec import Copilot.Language.Stream (Stream (..), Arg (..))@@ -39,14 +38,12 @@   let obsvs = observers  $ runSpec spec   let props = properties $ runSpec spec   let thms  = reverse $ theorems $ runSpec spec-  --let strs  = structs    $ runSpec spec   refMkId         <- newIORef 0   refVisited      <- newIORef M.empty   refMap          <- newIORef []   coreTriggers    <- mapM (mkTrigger  refMkId refVisited refMap) trigs   coreObservers   <- mapM (mkObserver refMkId refVisited refMap) obsvs   coreProperties  <- mapM (mkProperty refMkId refVisited refMap) $ props ++ (map fst thms)-  --coreStructs     <- mapM (mkStruct   refMkId refVisited refMap) strs   coreStreams     <- readIORef refMap    let cspec = Core.Spec@@ -54,7 +51,6 @@         , Core.specObservers  = coreObservers         , Core.specTriggers   = coreTriggers         , Core.specProperties = coreProperties }-        --, Core.specStructs    = coreStructs }    results <- sequence $ zipWith (prove cspec) (map (\(Property n _,_) -> n) thms) $ map snd thms   unless (and results) $ putStrLn "Warning: failed to check some proofs."@@ -124,30 +120,6 @@  -------------------------------------------------------------------------------- ---{-# INLINE mkStruct #-}-{-mkStruct-  :: IORef Int-  -> IORef (Map Core.Id)-  -> IORef [Core.Stream]-  -> StructData-  -> IO Core.StructData-mkStruct refMkId refStreams refMap (StructData name fields) = do-    fields' <- mapM mkStructField fields-    return $-      Core.StructData-        { Core.structName    = name-        , Core.structFields  = fields' }--    where--    mkStructField :: String -> Arg -> IO (Core.Name, Core.UExpr)-    mkStructField cs (Arg e) = do-      w <- mkExpr refMkId refStreams refMap e-      return (cs, $ Core.UExpr typeOf w)--}----------------------------------------------------------------------------------- -- | Transform a Copilot stream expression into a Copilot Core expression. {-# INLINE mkExpr #-} mkExpr@@ -159,8 +131,6 @@   -> IO (Core.Expr a) mkExpr refMkId refStreams refMap = go ---  (>>= go) . makeSharingExplicit refMkId-   where   go :: Typed a => Stream a -> IO (Core.Expr a)   go e0 = case e0 of@@ -238,31 +208,6 @@   mkStrArg (name, Arg e) = do     w <- mkExpr refMkId refStreams refMap e     return $ (name, Core.UExpr typeOf w)--  {-mkStructArg :: StructArg -> IO Core.SExpr-  mkStructArg (StructArg { name_ = n, arg' = Arg a }) = do-      w <- mkExpr refMkId refStreams refMap a-      return $ Core.SExpr n $ Core.UExpr typeOf w--}-------------------------------------------------------------------------------------{-# INLINE mkStruct #-}-{-mkStruct-  :: IORef Int-  -> IORef (Map Core.Id)-  -> IORef [Core.Stream]-  -> StructData-  -> IO Core.StructData-mkStruct refMkId refStreams refMap (StructData name sargs) = trace (show name) $ do-  args' <- mapM mkStructArg sargs-  return $-    Core.StructData-      { Core.structName     = name-      , Core.structInst     = Core.ExternStruct typeOf "" args' Nothing }-    where-      mkStructArg (StructArg { name_ = n, arg' = Arg a }) = do-        w <- mkExpr refMkId refStreams refMap a-        return $ Core.SExpr n $ Core.UExpr typeOf w-}  -------------------------------------------------------------------------------- 
src/Copilot/Language/Spec.hs view
@@ -36,9 +36,7 @@ import Prelude hiding (not)  import Control.Monad.Writer---import Data.Maybe (fromMaybe) ---import Copilot.Core (Typed, Struct) import Copilot.Core (Typed) import qualified Copilot.Core as Core import Copilot.Language.Stream@@ -229,22 +227,4 @@ arg :: Typed a => Stream a -> Arg arg = Arg -----------------------------------------------------------------------------------{---- | Struct operator.---- Look up the given struct x, and return field y (which should be a stream?)-(#) :: Typed a => Core.StructData -> String -> Stream a-(Core.StructData {Core.structName = x, Core.structArgs = y})#z = getField x z-  where-    getField struct_nm field_nm =-      let test = find (\(Core.StructData name _) -> name == struct_nm) structs in-      case test of-        Nothing -> error "No struct named \"" ++ struct_nm ++ "\" in the spec"-        Just element ->-          fromMaybe (find (\(Core.SExpr name _) -> name == field_nm) (element Core.structArgs))-            (error "No field by the name of \"" ++ field_nm ++ "\"") element---(Core.StructData l m)#n = Op2 (Core.GetField Core.typeOf) (Core.StructData l m) n--} --------------------------------------------------------------------------------
src/Copilot/Language/Stream.hs view
@@ -57,6 +57,7 @@   Arg :: Typed a => Stream a -> Arg  data StructArg = StructArg { name_ :: String, arg' :: Arg }+{-# DEPRECATED StructArg "StructArg is deprecated" #-}  --------------------------------------------------------------------------------