copilot-language 3.5 → 3.6
raw patch · 8 files changed
+71/−18 lines, 8 filesdep ~copilot-coredep ~copilot-theoremPVP ok
version bump matches the API change (PVP)
Dependency ranges changed: copilot-core, copilot-theorem
API changes (from Hackage documentation)
- Copilot.Language.Operators.Extern: funArg :: Typed a => Stream a -> Arg
+ Copilot.Language.Stream: atan2 :: (Typed a, RealFloat a) => Stream a -> Stream a -> Stream a
+ Copilot.Language.Stream: ceiling :: (Typed a, RealFrac a) => Stream a -> Stream a
+ Copilot.Language.Stream: floor :: (Typed a, RealFrac a) => Stream a -> Stream a
Files
- CHANGELOG +7/−0
- README.md +3/−3
- copilot-language.cabal +3/−3
- src/Copilot/Language/Operators/Extern.hs +0/−6
- src/Copilot/Language/Operators/Integral.hs +4/−3
- src/Copilot/Language/Reify.hs +2/−1
- src/Copilot/Language/Stream.hs +51/−1
- src/System/Mem/StableName/Map.hs +1/−1
CHANGELOG view
@@ -1,3 +1,10 @@+2021-11-07+ * Version bump (3.6). (#264)+ * Replace uses of copilot-core's error reporting functions. (#267)+ * Introduce new ops atan2, ceiling, floor. (#246)+ * Remove deprecated function. (#250)+ * Fix outdated/broken links. (#252)+ 2021-08-19 * Version bump (3.5). (#247) * Update travis domain in README. (#222)
README.md view
@@ -1,11 +1,11 @@-[](https://travis-ci.com/Copilot-Language/copilot-core)+[](https://app.travis-ci.com/github/Copilot-Language/copilot) # Copilot: a stream DSL Copilot-language contains the actual embedded domain specific language that Copilot provides to its users. It comes with a series of basic operators and functionality, typically enough for most applications. Extended functionality is provided by the-[copilot-libraries](https://github.com/Copilot-Language/copilot-libraries)+[copilot-libraries](https://github.com/Copilot-Language/copilot/tree/master/copilot-libraries) module. Copilot is a runtime verification framework written in Haskell. It allows the@@ -34,4 +34,4 @@ ## License Copilot is distributed under the BSD-3-Clause license, which can be found-[here](https://raw.githubusercontent.com/Copilot-Language/copilot/master/LICENSE).+[here](https://raw.githubusercontent.com/Copilot-Language/copilot/master/copilot-language/LICENSE).
copilot-language.cabal view
@@ -1,6 +1,6 @@ cabal-version: >=1.10 name: copilot-language-version: 3.5+version: 3.6 synopsis: A Haskell-embedded DSL for monitoring hard real-time distributed systems. description:@@ -40,8 +40,8 @@ , data-reify >= 0.6 && < 0.7 , mtl >= 2.0 && < 3 - , copilot-core >= 3.5 && < 3.6- , copilot-theorem >= 3.5 && < 3.6+ , copilot-core >= 3.6 && < 3.7+ , copilot-theorem >= 3.6 && < 3.7 exposed-modules: Copilot , Copilot.Language
src/Copilot/Language/Operators/Extern.hs view
@@ -18,7 +18,6 @@ , externI32 , externI64 , externD- , funArg ) where import Copilot.Core (Typed)@@ -41,11 +40,6 @@ -> Maybe [a] -- ^ Values to be used exclusively for testing/simulation. -> Stream a extern = Extern---- | Deprecated.-funArg :: Typed a => Stream a -> Arg-funArg = Arg-{-# DEPRECATED funArg "funArg is deprecated" #-} --------------------------------------------------------------------------------
src/Copilot/Language/Operators/Integral.hs view
@@ -14,6 +14,7 @@ import Copilot.Core (Typed, typeOf) import qualified Copilot.Core as Core+import qualified Copilot.Language.Error as Err import Copilot.Language.Operators.BitWise ((.<<.)) import Copilot.Language.Stream @@ -26,13 +27,13 @@ -- | Apply the 'Prelude.div' operation to two streams, point-wise. div :: (Typed a, P.Integral a) => Stream a -> Stream a -> Stream a (Const 0) `div` _ = Const 0-_ `div` (Const 0) = Core.badUsage "in div: division by zero."+_ `div` (Const 0) = Err.badUsage "in div: division by zero." x `div` (Const 1) = x x `div` y = Op2 (Core.Div typeOf) x y -- | Apply the 'Prelude.mod' operation to two streams, point-wise. mod :: (Typed a, P.Integral a) => Stream a -> Stream a -> Stream a-_ `mod` (Const 0) = Core.badUsage "in mod: division by zero."+_ `mod` (Const 0) = Err.badUsage "in mod: division by zero." (Const 0) `mod` _ = (Const 0) (Const x) `mod` (Const y) = Const (x `P.mod` y) x `mod` y = Op2 (Core.Mod typeOf) x y@@ -49,6 +50,6 @@ (Const x) ^ (Const y) = Const (x P.^ y) (Const 2) ^ y = (Const 1) .<<. y x ^ (Const y) = foldl' ((P.*)) (Const 1) (replicate (P.fromIntegral y) x)-_ ^ _ = Core.badUsage "in ^: in x ^ y, either x must be the constant 2, or y must be a constant. (Do not confuse ^ with bitwise XOR (.^.) or with ** for exponentation of floats/doubles.)"+_ ^ _ = Err.badUsage "in ^: in x ^ y, either x must be the constant 2, or y must be a constant. (Do not confuse ^ with bitwise XOR (.^.) or with ** for exponentation of floats/doubles.)" --------------------------------------------------------------------------------
src/Copilot/Language/Reify.hs view
@@ -13,9 +13,10 @@ ) where import qualified Copilot.Core as Core-import Copilot.Core (Typed, Id, typeOf, impossible)+import Copilot.Core (Typed, Id, typeOf) import Copilot.Language.Analyze (analyze)+import Copilot.Language.Error (impossible) import Copilot.Language.Spec import Copilot.Language.Stream (Stream (..), Arg (..))
src/Copilot/Language/Stream.hs view
@@ -13,11 +13,14 @@ ( Stream (..) , Arg (..) , StructArg (..)+ , Copilot.Language.Stream.ceiling+ , Copilot.Language.Stream.floor+ , Copilot.Language.Stream.atan2 ) where import Copilot.Core (Typed, typeOf)-import Copilot.Core.Error import qualified Copilot.Core as Core+import Copilot.Language.Error import Copilot.Language.Prelude import qualified Prelude as P @@ -144,3 +147,50 @@ acosh = Op1 (Core.Acosh typeOf) --------------------------------------------------------------------------------++-- | Point-wise application of @ceiling@ to a stream.+--+-- Unlike the Haskell variant of this function, this variant takes and returns+-- two streams of the same type. Use a casting function to convert the result+-- to an intergral type of your choice.+--+-- Note that the result can be too big (or, if negative, too small) for that+-- type (see the man page of @ceil@ for details), so you must check that the+-- value fits in the desired integral type before casting it.+--+-- This definition clashes with one in 'RealFrac' in Haskell's Prelude,+-- re-exported from @Language.Copilot@, so you need to import this module+-- qualified to use this function.+ceiling :: (Typed a, RealFrac a) => Stream a -> Stream a+ceiling = Op1 (Core.Ceiling typeOf)++-- | Point-wise application of @floor@ to a stream.+--+-- Unlike the Haskell variant of this function, this variant takes and returns+-- two streams of the same type. Use a casting function to convert the result+-- to an intergral type of your choice.+--+-- Note that the result can be too big (or, if negative, too small) for that+-- type (see the man page of @floor@ for details), so you must check that the+-- value fits in the desired integral type before casting it.+--+-- This definition clashes with one in 'RealFrac' in Haskell's Prelude,+-- re-exported from @Language.Copilot@, so you need to import this module+-- qualified to use this function.+floor :: (Typed a, RealFrac a) => Stream a -> Stream a+floor = Op1 (Core.Floor typeOf)+++--------------------------------------------------------------------------------++-- | Point-wise application of @atan2@ to the values of two streams.+--+-- For each pair of real floating-point samples @x@ and @y@, one from each+-- stream, @atan2@ computes the angle of the vector from @(0, 0)@ to the point+-- @(x, y)@.+--+-- This definition clashes with one in 'RealFloat' in Haskell's Prelude,+-- re-exported from @Language.Copilot@, so you need to import this module+-- qualified to use this function.+atan2 :: (Typed a, RealFloat a) => Stream a -> Stream a -> Stream a+atan2 = Op2 (Core.Atan2 typeOf)
src/System/Mem/StableName/Map.hs view
@@ -25,7 +25,7 @@ import qualified Data.IntMap as IntMap import Data.IntMap (IntMap) -import Copilot.Core.Error (impossible)+import Copilot.Language.Error (impossible) data Map a = Map { getMap :: IntMap [(DynStableName, a)] , getSize :: Int }