copilot-core 4.0 → 4.1
raw patch · 3 files changed
+41/−12 lines, 3 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
Files
- CHANGELOG +16/−10
- copilot-core.cabal +1/−1
- src/Copilot/Core/Type.hs +24/−1
CHANGELOG view
@@ -1,3 +1,9 @@+2024-11-07+ * Version bump (4.1). (#561)+ * Add Haddocks for updateField. (#525)+ * Standardize changelog format. (#550)+ * Deprecate Copilot.Core.Type.UType.uTypeType. (#484)+ 2024-09-07 * Version bump (4.0). (#532) * Update Op3, Array to support array updates. (#36)@@ -136,15 +142,15 @@ * Version bump (3.2.1). (#136) * Completed the documentation. (#145) -2020-12-06 Ivan Perez <ivan.perez@acm.org>- * Version bump (3.2).- * Fixed implementation of tysize for n-dimensional arrays. (#147).- * Removed sorting of interpreter output (#148).- * Minor documentation fixes (#149, #151).+2020-12-06+ * Version bump (3.2). (#65)+ * Fixed implementation of tysize for n-dimensional arrays. (#147)+ * Removed sorting of interpreter output. (#148)+ * Minor documentation fixes. (#149, #151) * Credits: @fdedden. -2019-11-22 Ivan Perez <ivan.perez@nianet.org>- * Version bump (3.1).- * Eliminate random modules and generators (#157).- * Updated contact information for 'impossible' error (#154).- * Implement missing pretty printer for Index operator (#155).+2019-11-22+ * Version bump (3.1). (#46)+ * Eliminate random modules and generators. (#157)+ * Updated contact information for 'impossible' error. (#154)+ * Implement missing pretty printer for Index operator. (#155)
copilot-core.cabal view
@@ -1,6 +1,6 @@ cabal-version: >=1.10 name: copilot-core-version: 4.0+version: 4.1 synopsis: An intermediate representation for Copilot. description: Intermediate representation for Copilot.
src/Copilot/Core/Type.hs view
@@ -60,8 +60,30 @@ -- | Transforms all the struct's fields into a list of values. toValues :: a -> [Value a] + -- | Update the value of a struct field. This is only used by the Copilot+ -- interpreter, so if you do not plan to use the interpreter, it is safe to+ -- omit an implementation of this method.+ --+ -- In order to implement 'updateField', you should do the following for each+ -- 'Field' in a struct:+ --+ -- 1. Check that the name of the 'Field' matches the name of the supplied+ -- 'Value' (using 'GHC.TypeLits.sameSymbol').+ --+ -- 2. Check that the type of the 'Field' matches the 'Type' of the supplied+ -- 'Value' (using 'DE.testEquality').+ --+ -- 3. If both (1) and (2) succeed, update the corresponding struct field using+ -- a record update.+ --+ -- For a complete end-to-end example that demonstrates how to implement+ -- 'updateField' and use it in the Copilot interpreter, see the+ -- @examples/StructsUpdateField.hs@ example in the @copilot@ library. updateField :: a -> Value t -> a- updateField = error "Field updates not supported for this type."+ updateField = error $ unlines+ [ "Field updates not supported for this type."+ , "(Perhaps you need to implement 'updateField' for a 'Struct' instance?)"+ ] -- | The field of a struct, together with a representation of its type. data Value a =@@ -246,6 +268,7 @@ -- | A untyped type (no phantom type). data UType = forall a . Typeable a => UType { uTypeType :: Type a }+{-# DEPRECATED uTypeType "This field is deprecated in Copilot 4.1. Use pattern matching instead." #-} instance Eq UType where UType ty1 == UType ty2 = typeRep ty1 == typeRep ty2