copilot-core 3.19.1 → 3.20
raw patch · 4 files changed
+18/−4 lines, 4 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
+ Copilot.Core.Operators: [UpdateField] :: (Typeable b, KnownSymbol s, Show b) => Type a -> Type b -> (a -> Field s b) -> Op2 a b a
+ Copilot.Core.Type: updateField :: Struct a => a -> Value t -> a
Files
- CHANGELOG +4/−0
- copilot-core.cabal +1/−1
- src/Copilot/Core/Operators.hs +9/−3
- src/Copilot/Core/Type.hs +4/−0
CHANGELOG view
@@ -1,3 +1,7 @@+2024-07-07+ * Version bump (3.20). (#522)+ * Update Op2, Struct to support struct field updates. (#520)+ 2024-05-07 * Version bump (3.19.1). (#512)
copilot-core.cabal view
@@ -1,6 +1,6 @@ cabal-version: >=1.10 name: copilot-core-version: 3.19.1+version: 3.20 synopsis: An intermediate representation for Copilot. description: Intermediate representation for Copilot.
src/Copilot/Core/Operators.hs view
@@ -13,9 +13,10 @@ where -- External imports-import Data.Bits (Bits)-import Data.Word (Word32)-import GHC.TypeLits (KnownSymbol)+import Data.Bits (Bits)+import Data.Typeable (Typeable)+import Data.Word (Word32)+import GHC.TypeLits (KnownSymbol) -- Internal imports import Copilot.Core.Type (Field (..), Type (..))@@ -95,6 +96,11 @@ -- Array operator. Index :: Type (Array n t) -> Op2 (Array n t) Word32 t -- ^ Array access/projection of an array element.++ -- Struct operator.+ UpdateField :: (Typeable b, KnownSymbol s, Show b)+ => Type a -> Type b -> (a -> Field s b) -> Op2 a b a+ -- ^ Update a field of a struct. -- | Ternary operators. data Op3 a b c d where
src/Copilot/Core/Type.hs view
@@ -34,6 +34,7 @@ , Struct , fieldName , accessorName+ , updateField ) where @@ -58,6 +59,9 @@ -- | Transforms all the struct's fields into a list of values. toValues :: a -> [Value a]++ updateField :: a -> Value t -> a+ updateField = error "Field updates not supported for this type." -- | The field of a struct, together with a representation of its type. data Value a =