packages feed

copilot-libraries 3.20 → 4.0

raw patch · 4 files changed

+33/−22 lines, 4 filesdep ~copilot-languagePVP ok

version bump matches the API change (PVP)

Dependency ranges changed: copilot-language

API changes (from Hackage documentation)

+ Copilot.Library.Libraries: (!!!) :: (Typed a, Eq b, Num b, Typed b) => [Stream a] -> Stream b -> Stream a
+ Copilot.Library.Libraries: case' :: Typed a => [Stream Bool] -> [Stream a] -> Stream a
+ Copilot.Library.Libraries: cycle :: Typed a => [a] -> Stream a
+ Copilot.Library.Libraries: nfoldl :: (Typed a, Typed b) => Int -> (Stream a -> Stream b -> Stream a) -> Stream a -> Stream b -> Stream a
+ Copilot.Library.Libraries: nfoldl1 :: Typed a => Int -> (Stream a -> Stream a -> Stream a) -> Stream a -> Stream a
+ Copilot.Library.Libraries: nfoldr :: (Typed a, Typed b) => Int -> (Stream a -> Stream b -> Stream b) -> Stream b -> Stream a -> Stream b
+ Copilot.Library.Libraries: nfoldr1 :: Typed a => Int -> (Stream a -> Stream a -> Stream a) -> Stream a -> Stream a
+ Copilot.Library.Libraries: nscanl :: (Typed a, Typed b) => Int -> (Stream a -> Stream b -> Stream a) -> Stream a -> Stream b -> [Stream a]
+ Copilot.Library.Libraries: nscanl1 :: Typed a => Int -> (Stream a -> Stream a -> Stream a) -> Stream a -> [Stream a]
+ Copilot.Library.Libraries: nscanr :: Typed a => Int -> (Stream a -> Stream b -> Stream b) -> Stream b -> Stream a -> [Stream b]
+ Copilot.Library.Libraries: nscanr1 :: Typed a => Int -> (Stream a -> Stream a -> Stream a) -> Stream a -> [Stream a]
+ Copilot.Library.Libraries: tails :: Typed a => Stream a -> [Stream a]
+ Copilot.Library.Libraries: take :: (Integral a, Typed b) => a -> Stream b -> [Stream b]
+ Copilot.Library.Utils: (!!!) :: (Typed a, Eq b, Num b, Typed b) => [Stream a] -> Stream b -> Stream a

Files

CHANGELOG view
@@ -1,3 +1,7 @@+2024-09-07+        * Version bump (4.0). (#532)+        * Rename operator to avoid name clash. (#36)+ 2024-07-07         * Version bump (3.20). (#522) 
copilot-libraries.cabal view
@@ -1,6 +1,6 @@ cabal-version:       >=1.10 name:                copilot-libraries-version:             3.20+version:             4.0 synopsis:            Libraries for the Copilot language. description:   Libraries for the Copilot language.@@ -36,12 +36,12 @@    hs-source-dirs: src -  build-depends: base             >= 4.9  && < 5+  build-depends: base             >= 4.9 && < 5 -               , containers       >= 0.4  && < 0.7-               , mtl              >= 2.0  && < 2.4-               , parsec           >= 2.0  && < 3.2-               , copilot-language >= 3.20 && < 3.21+               , containers       >= 0.4 && < 0.7+               , mtl              >= 2.0 && < 2.4+               , parsec           >= 2.0 && < 3.2+               , copilot-language >= 4.0 && < 4.1    exposed-modules:       Copilot.Library.Libraries
src/Copilot/Library/Libraries.hs view
@@ -23,6 +23,6 @@ import Copilot.Library.PTLTL import Copilot.Library.Statistics import Copilot.Library.RegExp-import Copilot.Library.Utils+import Copilot.Library.Utils      hiding ((!!)) import Copilot.Library.Voting import Copilot.Library.Stacks
src/Copilot/Library/Utils.hs view
@@ -13,10 +13,10 @@          -- ** Scans          nscanl, nscanr, nscanl1, nscanr1,          -- ** Indexing-         case', (!!))+         case', (!!), (!!!)) where -import Copilot.Language+import Copilot.Language hiding ((!!)) import qualified Prelude as P  -- | Given a stream, produce an infinite list of streams dropping an increasing@@ -135,21 +135,28 @@ -- -- WARNING: Very expensive! Consider using this only for very short lists. (!!) :: (Typed a, Eq b, Num b, Typed b) => [Stream a] -> Stream b -> Stream a-ls !! n = let indices      = map+(!!) = (!!!)+{-# DEPRECATED (!!) "This function is deprecated in Copilot 4. Use (!!!)." #-}++-- | Index.+--+-- WARNING: Very expensive! Consider using this only for very short lists.+(!!!) :: (Typed a, Eq b, Num b, Typed b) => [Stream a] -> Stream b -> Stream a+ls !!! n = let indices      = map                              ( constant . fromIntegral )                              [ 0 .. P.length ls - 1 ]-              select [] _  = last ls-              select-                ( i : is )-                ( x : xs ) = mux ( i == n ) x ( select is xs )-                             -- should not happen-              select _ []  = badUsage ("in (!!) defined in Utils.hs " P.++-                               "in copilot-libraries")-          in if null ls then-               badUsage ("in (!!) defined in Utils.hs " P.++-                            "indexing the empty list with !! is not defined")-             else-               select indices ls+               select [] _  = last ls+               select+                 ( i : is )+                 ( x : xs ) = mux ( i == n ) x ( select is xs )+                              -- should not happen+               select _ []  = badUsage ("in (!!) defined in Utils.hs " P.+++                                "in copilot-libraries")+           in if null ls then+                badUsage ("in (!!) defined in Utils.hs " P.+++                             "indexing the empty list with !! is not defined")+              else+                select indices ls  -- | Cycle a list to form an infinite stream. cycle :: ( Typed a ) => [ a ] -> Stream a