copilot-core 3.1 → 3.2
raw patch · 5 files changed
+33/−26 lines, 5 filesdep −containersPVP ok
version bump matches the API change (PVP)
Dependencies removed: containers
API changes (from Hackage documentation)
- Copilot.Core.Interpret.Eval: ExecTrace :: Map String [Maybe [Output]] -> Map String [Output] -> ExecTrace
+ Copilot.Core.Interpret.Eval: ExecTrace :: [(String, [Maybe [Output]])] -> [(String, [Output])] -> ExecTrace
- Copilot.Core.Interpret.Eval: [interpObservers] :: ExecTrace -> Map String [Output]
+ Copilot.Core.Interpret.Eval: [interpObservers] :: ExecTrace -> [(String, [Output])]
- Copilot.Core.Interpret.Eval: [interpTriggers] :: ExecTrace -> Map String [Maybe [Output]]
+ Copilot.Core.Interpret.Eval: [interpTriggers] :: ExecTrace -> [(String, [Maybe [Output]])]
- Copilot.Core.Type: Field :: t -> Field t
+ Copilot.Core.Type: Field :: t -> Field (s :: Symbol) t
Files
- CHANGELOG +12/−0
- copilot-core.cabal +7/−8
- src/Copilot/Core/Interpret/Eval.hs +4/−6
- src/Copilot/Core/Interpret/Render.hs +9/−11
- src/Copilot/Core/Type.hs +1/−1
+ CHANGELOG view
@@ -0,0 +1,12 @@+2020-12-06 Ivan Perez <ivan.perez@acm.org>+ * Version bump (3.2).+ * Fixed implementation of tysize for n-dimensional arrays. (#20).+ * Removed sorting of interpreter output (#19).+ * Minor documentation fixes (#17, #15).+ * Credits: @fdedden.++2019-11-22 Ivan Perez <ivan.perez@nianet.org>+ * Version bump (3.1).+ * Eliminate random modules and generators (#9).+ * Updated contact information for 'impossible' error (#12).+ * Implement missing pretty printer for Index operator (#11).
copilot-core.cabal view
@@ -1,28 +1,28 @@ cabal-version: >=1.10 name: copilot-core-version: 3.1+version: 3.2 synopsis: An intermediate representation for Copilot. description: Intermediate representation for Copilot. . Copilot is a stream (i.e., infinite lists) domain-specific language (DSL) in Haskell that compiles into embedded C. Copilot contains an interpreter,- multiple back-end compilers, and other verification tools. A tutorial, bug- reports, and todos are available at- <https://github.com/Copilot-Language/copilot-discussion>.+ multiple back-end compilers, and other verification tools. .- Examples are available at- <https://github.com/Copilot-Language/Copilot/tree/master/Examples>.+ A tutorial, examples, and other information are available at+ <https://copilot-language.github.io>. author: Frank Dedden, Lee Pike, Robin Morisset, Alwyn Goodloe, Sebastian Niller, Nis Nordbyop Wegmann license: BSD3 license-file: LICENSE maintainer: Frank Dedden <dev@dedden.net>+homepage: https://copilot-language.github.io+bug-reports: https://github.com/Copilot-Language/copilot-core/issues stability: Experimental category: Language, Embedded build-type: Simple-extra-source-files: README.md+extra-source-files: README.md, CHANGELOG source-repository head type: git@@ -41,7 +41,6 @@ build-depends: base >= 4.9 && < 5,- containers >= 0.4 && < 0.7, pretty >= 1.0 && < 1.2, mtl >= 2.0 && < 2.3, dlist
src/Copilot/Core/Interpret/Eval.hs view
@@ -22,8 +22,6 @@ import qualified Prelude as P import Data.List (transpose)-import qualified Data.Map as M-import Data.Map (Map) import Data.Maybe (fromJust) import Data.Bits import Control.Exception (Exception, throw)@@ -105,9 +103,9 @@ -- representing their values. (Nothing output if the guard for the trigger -- is false). The order is important, since we compare the arg lists -- between the interpreter and backends.- { interpTriggers :: Map String [Maybe [Output]]+ { interpTriggers :: [(String, [Maybe [Output]])] -- map from observer names to their outputs. We also show observer outputs.- , interpObservers :: Map String [Output] }+ , interpObservers :: [(String, [Output])] } deriving Show --------------------------------------------------------------------------------@@ -146,9 +144,9 @@ (specObservers spec) in strms `seq` ExecTrace- { interpTriggers = M.fromList $+ { interpTriggers = zip (map triggerName (specTriggers spec)) trigs- , interpObservers = M.fromList $+ , interpObservers = zip (map observerName (specObservers spec)) obsvs }
src/Copilot/Core/Interpret/Render.hs view
@@ -14,7 +14,6 @@ import Data.List (intersperse, transpose, foldl') import Data.Maybe (catMaybes) import Copilot.Core.Interpret.Eval (Output, ExecTrace (..))-import qualified Data.Map as M import Text.PrettyPrint import Prelude hiding ((<>))@@ -34,20 +33,20 @@ where ppTriggerNames :: [Doc]- ppTriggerNames = map (text . (++ ":")) (M.keys trigs)+ ppTriggerNames = map (text . (++ ":")) (map fst trigs) ppObserverNames :: [Doc]- ppObserverNames = map (text . (++ ":")) (M.keys obsvs)+ ppObserverNames = map (text . (++ ":")) (map fst obsvs) ppTriggerOutputs :: [[Doc]]- ppTriggerOutputs = map (map ppTriggerOutput) (M.elems trigs)+ ppTriggerOutputs = map (map ppTriggerOutput) (map snd trigs) ppTriggerOutput :: Maybe [Output] -> Doc ppTriggerOutput (Just vs) = text $ "(" ++ concat (intersperse "," vs) ++ ")" ppTriggerOutput Nothing = text "--" ppObserverOutputs :: [[Doc]]- ppObserverOutputs = map (map text) (M.elems obsvs)+ ppObserverOutputs = map (map text) (map snd obsvs) -------------------------------------------------------------------------------- @@ -64,7 +63,7 @@ step ExecTrace { interpTriggers = trigs } =- if M.null trigs then (empty, Nothing)+ if null trigs then (empty, Nothing) else (foldl' ($$) empty (text "#" : ppTriggerOutputs), tails) where@@ -73,8 +72,7 @@ ppTriggerOutputs = catMaybes . fmap ppTriggerOutput- . M.assocs- . fmap head+ . map (fmap head) $ trigs ppTriggerOutput :: (String, Maybe [Output]) -> Maybe Doc@@ -85,12 +83,12 @@ tails :: Maybe ExecTrace tails =- if any null (M.elems (fmap tail trigs))+ if any null (fmap (tail.snd) trigs) then Nothing else Just ExecTrace- { interpTriggers = fmap tail trigs- , interpObservers = M.empty+ { interpTriggers = map (fmap tail) trigs+ , interpObservers = [] } --------------------------------------------------------------------------------
src/Copilot/Core/Type.hs view
@@ -95,7 +95,7 @@ -- Get the total (nested) size of an array from its type tysize :: forall n t. KnownNat n => Type (Array n t) -> Int-tysize ty@(Array ty'@(Array _)) = tylength ty * tylength ty'+tysize ty@(Array ty'@(Array _)) = tylength ty * tysize ty' tysize ty@(Array _ ) = tylength ty instance EqualType Type where