From 7645f7089b267b469b1fd2dc0078b3ce4746f4a7 Mon Sep 17 00:00:00 2001 From: Ben Orchard Date: Thu, 17 Oct 2024 05:30:15 +0100 Subject: [PATCH 01/10] add to-do on stripping strongweak --- TODO.md | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/TODO.md b/TODO.md index 777581c..74be65b 100644 --- a/TODO.md +++ b/TODO.md @@ -1,4 +1,18 @@ # binrep to-dos +## Separate from strongweak +I don't use strongweak here, only write a few useful instances. +I could have a separate package for orphan instances instead. +This would make me much happier about: + +* the `WeakenN` instances, which are the only "through" newtype currently + permitted in binrep -- these would be over there +* the `ByteOrdered` orphans -- they would be over there + +But I feel comfortable with the `Magic` weakening being here. And strongweak is +a small package. But still... + +Yes, I think I should do this. No, I don't think it's very interesting or fun. + ## Discrepancy in generic sum interface In `Get`, I require a `Getter pt`. But in `Put`/`BLen`, you have to pass the `Putter`/`BLen` manually. I'm not sure which one is correct. Probably `Get`. From a98ac7f0ab17d1a5f6340e40454aaf579acec6a0 Mon Sep 17 00:00:00 2001 From: Ben Orchard Date: Thu, 17 Oct 2024 05:30:27 +0100 Subject: [PATCH 02/10] Type.Magic: remove strongweak instances --- src/Binrep/Type/Magic.hs | 9 --------- 1 file changed, 9 deletions(-) diff --git a/src/Binrep/Type/Magic.hs b/src/Binrep/Type/Magic.hs index 1f768fe..fafe836 100644 --- a/src/Binrep/Type/Magic.hs +++ b/src/Binrep/Type/Magic.hs @@ -26,7 +26,6 @@ import GHC.TypeLits ( type Natural, type Symbol, type KnownNat, type (+) ) import GHC.Generics ( Generic ) import Data.Data ( Data ) -import Strongweak import Binrep import Bytezap.Struct.TypeLits.Bytes ( ReifyBytesW64(reifyBytesW64) ) @@ -49,14 +48,6 @@ applications). That kind is always evident from the type, so it's just nicer. data Magic a where Magic :: forall {k} (a :: k). Magic a deriving stock (Generic, Data, Show, Eq) --- | Weaken a @'Magic' a@ to the unit '()'. -instance Weaken (Magic a) where - type Weakened (Magic a) = () - weaken Magic = () - --- | Strengthen the unit '()' to some @'Magic' a@. -instance Strengthen (Magic a) where strengthen () = Right Magic - -- | The byte length of a magic is known at compile time. instance IsCBLen (Magic a) where type CBLen (Magic a) = Length (MagicBytes a) From 293d670d454907b9c676b9c2ae8c54e7dd69d733 Mon Sep 17 00:00:00 2001 From: Ben Orchard Date: Thu, 17 Oct 2024 05:35:08 +0100 Subject: [PATCH 03/10] Util.ByteOrder: remove strongweak instances --- src/Binrep/Util/ByteOrder.hs | 4 ---- 1 file changed, 4 deletions(-) diff --git a/src/Binrep/Util/ByteOrder.hs b/src/Binrep/Util/ByteOrder.hs index eaa99d6..f9db230 100644 --- a/src/Binrep/Util/ByteOrder.hs +++ b/src/Binrep/Util/ByteOrder.hs @@ -7,12 +7,8 @@ module Binrep.Util.ByteOrder import Raehik.Compat.Data.Primitive.Types.Endian ( ByteOrdered(..) ) import GHC.ByteOrder ( ByteOrder(..) ) -import Strongweak import GHC.TypeLits ( type Symbol ) -deriving via SWCoercibly a instance Weaken (ByteOrdered end a) -deriving via SWCoercibly a instance Strengthen (ByteOrdered end a) - -- shorter names I originally used type LE = LittleEndian type BE = BigEndian From 8b1f96a38315ce1e744bff93f1b2f63156554d4e Mon Sep 17 00:00:00 2001 From: Ben Orchard Date: Thu, 17 Oct 2024 13:20:54 +0100 Subject: [PATCH 04/10] remove Identity, Const, SWChain instances --- flake.lock | 6 +++--- src/Binrep/BLen.hs | 8 ++------ src/Binrep/CBLen.hs | 11 +++-------- src/Binrep/Get.hs | 9 --------- src/Binrep/Get/Struct.hs | 25 ------------------------- src/Binrep/Put.hs | 9 --------- src/Binrep/Put/Struct.hs | 9 --------- src/Binrep/Type/Thin.hs | 8 -------- 8 files changed, 8 insertions(+), 77 deletions(-) diff --git a/flake.lock b/flake.lock index 515cb30..faea296 100644 --- a/flake.lock +++ b/flake.lock @@ -106,11 +106,11 @@ "strongweak": { "flake": false, "locked": { - "lastModified": 1729135838, - "narHash": "sha256-0a2d62gu3s+j1ArBba1SZju2nnc+xF+DXCRe/fvBtU4=", + "lastModified": 1729166117, + "narHash": "sha256-EluRAlznMM6VEwP8OBrulkglY4vaL2vVtcBNp0AaaHY=", "owner": "raehik", "repo": "strongweak", - "rev": "35831d7524cbfd4e9881b413911e66dc8fccb06a", + "rev": "f783d1641526ca7dda20ca80ff489fe2f24a1ff2", "type": "github" }, "original": { diff --git a/src/Binrep/BLen.hs b/src/Binrep/BLen.hs index d15fcd6..ded5ce9 100644 --- a/src/Binrep/BLen.hs +++ b/src/Binrep/BLen.hs @@ -45,8 +45,6 @@ import Binrep.Common.Via.Generically.NonSum import Rerefined.Refine import Rerefined.Predicate.Logical.And -import Strongweak.WeakenN - -- | Class for types with easily-calculated length in bytes. -- -- If it appears hard to calculate byte length for a given type (e.g. without @@ -130,13 +128,11 @@ deriving via ViaCBLen Word32 instance BLen Word32 deriving via ViaCBLen Int32 instance BLen Int32 deriving via ViaCBLen Word64 instance BLen Word64 deriving via ViaCBLen Int64 instance BLen Int64 + +-- | Explicitness does not alter length. deriving via ViaCBLen (ByteOrdered end a) instance KnownNat (CBLen a) => BLen (ByteOrdered end a) --- | Unwrap strongweak wrapper. -instance BLen a => BLen (WeakenN n a) where - blen = blen . unWeakenN - -------------------------------------------------------------------------------- -- | DerivingVia wrapper for types which may derive a 'BLen' instance through diff --git a/src/Binrep/CBLen.hs b/src/Binrep/CBLen.hs index de745ad..9f40b78 100644 --- a/src/Binrep/CBLen.hs +++ b/src/Binrep/CBLen.hs @@ -29,8 +29,6 @@ import Bytezap.Common.Generic ( type GTFoldMapCAddition ) import Binrep.Common.Via.Generically.NonSum -import Strongweak.WeakenN - class IsCBLen a where type CBLen a :: Natural -- | Deriving via this instance necessitates @UndecidableInstances@. @@ -55,12 +53,9 @@ instance IsCBLen Int32 where type CBLen Int32 = 2^2 instance IsCBLen Word64 where type CBLen Word64 = 2^3 instance IsCBLen Int64 where type CBLen Int64 = 2^3 -instance IsCBLen a => IsCBLen (ByteOrdered end a) where - type CBLen (ByteOrdered end a) = CBLen a - --- | Unwrap strongweak wrapper. -instance IsCBLen a => IsCBLen (WeakenN n a) where - type CBLen (WeakenN n a) = CBLen a +-- | Endianness does not alter constant length. +--deriving via (a :: Type) instance IsCBLen a => IsCBLen (ByteOrdered end a) +deriving via (a :: Type) instance IsCBLen (ByteOrdered end a) -- | Reify a type's constant byte length to the term level. cblen :: forall a. KnownNat (CBLen a) => Int diff --git a/src/Binrep/Get.hs b/src/Binrep/Get.hs index 4509a40..db5a4e2 100644 --- a/src/Binrep/Get.hs +++ b/src/Binrep/Get.hs @@ -43,7 +43,6 @@ import Rerefined.Predicate.Logical.And import Data.Word import Data.Int import Data.Void -import Data.Functor.Identity import Binrep.Common.Via.Generically.NonSum import Generic.Data.FOnCstr @@ -52,8 +51,6 @@ import GHC.Exts ( Proxy# ) import Data.Typeable ( Typeable, TypeRep, typeRep, Proxy(Proxy) ) -import Strongweak.WeakenN - type Getter = FP.Parser (ParseError FP.Pos TBL.Builder) class Get a where @@ -222,8 +219,6 @@ instance Get Write where -} -instance Get a => Get (Identity a) where get = Identity <$> get - -- | Unit type parses nothing. instance Get () where {-# INLINE get #-} @@ -324,7 +319,3 @@ runGetWith runGetWith r bs = runGetter (getWith r) bs -} - --- | Unwrap strongweak wrapper. -instance Get a => Get (WeakenN n a) where - get = WeakenN <$> get diff --git a/src/Binrep/Get/Struct.hs b/src/Binrep/Get/Struct.hs index 7ac462c..69df191 100644 --- a/src/Binrep/Get/Struct.hs +++ b/src/Binrep/Get/Struct.hs @@ -25,7 +25,6 @@ import Raehik.Compat.Data.Primitive.Types ( Prim' ) import Data.Word ( Word8 ) import Data.Int ( Int8 ) import Binrep.Util.ByteOrder -import Data.Functor.Identity import Raehik.Compat.Data.Primitive.Types.Endian ( ByteSwap ) import Data.ByteString qualified as B @@ -37,8 +36,6 @@ import Binrep.Common.Via.Generically.NonSum import Rerefined.Refine import Rerefined.Predicate.Logical.And -import Strongweak.WeakenN - type GetterC = Parser (ParseError Int TBL.Builder) -- | constant size parser @@ -129,8 +126,6 @@ instance Prim' a => GetC (ViaPrim a) where getC = ViaPrim <$> prim {-# INLINE getC #-} -instance GetC a => GetC (Identity a) where getC = Identity <$> getC - deriving via ViaPrim Word8 instance GetC Word8 deriving via ViaPrim Int8 instance GetC Int8 deriving via Word8 instance GetC (ByteOrdered end Word8) @@ -142,23 +137,3 @@ deriving via ViaPrim (ByteOrdered LittleEndian a) instance (Prim' a, ByteSwap a) => GetC (ByteOrdered LittleEndian a) deriving via ViaPrim (ByteOrdered BigEndian a) instance (Prim' a, ByteSwap a) => GetC (ByteOrdered BigEndian a) - -{- - -instance TypeError ENoEmpty => PutC Void where putC = undefined -instance TypeError ENoSum => PutC (Either a b) where putC = undefined - -instance PutC a => PutC (Identity a) where putC = putC . runIdentity - -instance PutC PutterC where putC = id - --- | Look weird? Yeah. But it's correct :) -instance (PutC l, KnownNat (CBLen l), PutC r) => PutC (l, r) where - {-# INLINE putC #-} - putC (l, r) = sequencePokes (putC l) (cblen @l) (putC r) - --} - --- | Unwrap strongweak wrapper. -instance GetC a => GetC (WeakenN n a) where - getC = WeakenN <$> getC diff --git a/src/Binrep/Put.hs b/src/Binrep/Put.hs index caa290f..043afcb 100644 --- a/src/Binrep/Put.hs +++ b/src/Binrep/Put.hs @@ -31,11 +31,8 @@ import Rerefined.Predicate.Logical.And import Data.Word import Data.Int import Data.Void -import Data.Functor.Identity import Binrep.Common.Via.Generically.NonSum -import Strongweak.WeakenN - type Putter = Poke RealWorld class Put a where put :: a -> Putter @@ -92,8 +89,6 @@ instance Prim' a => Put (ViaPrim a) where instance TypeError ENoEmpty => Put Void where put = undefined instance TypeError ENoSum => Put (Either a b) where put = undefined -instance Put a => Put (Identity a) where put = put . runIdentity - instance Put Putter where put = id -- | Unit type serializes to nothing. How zen. @@ -139,7 +134,3 @@ deriving via ViaPrim (ByteOrdered BigEndian a) -- predicate with the right. LOL REALLY? instance Put (Refined pr (Refined pl a)) => Put (Refined (pl `And` pr) a) where put = put . unsafeRefine @_ @pr . unsafeRefine @_ @pl . unrefine - --- | Unwrap strongweak wrapper. -instance Put a => Put (WeakenN n a) where - put = put . unWeakenN diff --git a/src/Binrep/Put/Struct.hs b/src/Binrep/Put/Struct.hs index e0ba3e3..13d8242 100644 --- a/src/Binrep/Put/Struct.hs +++ b/src/Binrep/Put/Struct.hs @@ -15,7 +15,6 @@ import Raehik.Compat.Data.Primitive.Types ( Prim' ) import Data.Word import Data.Int import Binrep.Util.ByteOrder -import Data.Functor.Identity import Raehik.Compat.Data.Primitive.Types.Endian ( ByteSwap ) import Binrep.Common.Class.TypeErrors ( ENoSum, ENoEmpty ) @@ -29,8 +28,6 @@ import Binrep.Common.Via.Generically.NonSum import Rerefined.Refine import Rerefined.Predicate.Logical.And -import Strongweak.WeakenN - type PutterC = Struct.Poke RealWorld -- | constant size putter @@ -76,8 +73,6 @@ instance Prim' a => PutC (ViaPrim a) where instance TypeError ENoEmpty => PutC Void where putC = undefined instance TypeError ENoSum => PutC (Either a b) where putC = undefined -instance PutC a => PutC (Identity a) where putC = putC . runIdentity - instance PutC PutterC where putC = id -- | Unit type serializes to nothing. How zen. @@ -110,7 +105,3 @@ deriving via ViaPrim (ByteOrdered LittleEndian a) instance (Prim' a, ByteSwap a) => PutC (ByteOrdered LittleEndian a) deriving via ViaPrim (ByteOrdered BigEndian a) instance (Prim' a, ByteSwap a) => PutC (ByteOrdered BigEndian a) - --- | Unwrap strongweak wrapper. -instance PutC a => PutC (WeakenN n a) where - putC = putC . unWeakenN diff --git a/src/Binrep/Type/Thin.hs b/src/Binrep/Type/Thin.hs index 6ea444c..8e95355 100644 --- a/src/Binrep/Type/Thin.hs +++ b/src/Binrep/Type/Thin.hs @@ -15,11 +15,8 @@ instance Copy B.ByteString where copy = B.copy @ But this just doesn't fly, because it would invert the behaviour. - -} -{-# LANGUAGE UndecidableInstances #-} -- for strongweak derivingvia - module Binrep.Type.Thin where import Binrep @@ -31,8 +28,6 @@ import Data.Data ( Data ) import GHC.Exts ( IsList ) import Data.String import Control.DeepSeq -import Data.Functor.Identity -import Strongweak import Data.ByteString qualified as B @@ -45,7 +40,4 @@ newtype Thin a = Thin { unThin :: a } , BLen, Put -- binrep ) via a - -- at the end of the day, we are the identity functor - deriving (Weaken, Strengthen) via Identity a - instance Get (Thin B.ByteString) where get = Thin <$> FP.takeRest From ced29ddabc9843f7a68c051e403885ac6152f8c3 Mon Sep 17 00:00:00 2001 From: Ben Orchard Date: Thu, 17 Oct 2024 13:23:12 +0100 Subject: [PATCH 05/10] tweak --- src/Binrep/CBLen.hs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/Binrep/CBLen.hs b/src/Binrep/CBLen.hs index 9f40b78..249ba43 100644 --- a/src/Binrep/CBLen.hs +++ b/src/Binrep/CBLen.hs @@ -54,8 +54,7 @@ instance IsCBLen Word64 where type CBLen Word64 = 2^3 instance IsCBLen Int64 where type CBLen Int64 = 2^3 -- | Endianness does not alter constant length. ---deriving via (a :: Type) instance IsCBLen a => IsCBLen (ByteOrdered end a) -deriving via (a :: Type) instance IsCBLen (ByteOrdered end a) +deriving via (a :: Type) instance IsCBLen a => IsCBLen (ByteOrdered end a) -- | Reify a type's constant byte length to the term level. cblen :: forall a. KnownNat (CBLen a) => Int From 86fba4e4cb9243600e63374bb184d64a15601a33 Mon Sep 17 00:00:00 2001 From: Ben Orchard Date: Tue, 11 Mar 2025 10:56:36 +0000 Subject: [PATCH 06/10] remove an unneeded pragma --- src/Binrep/Util/ByteOrder.hs | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/Binrep/Util/ByteOrder.hs b/src/Binrep/Util/ByteOrder.hs index f9db230..24142d9 100644 --- a/src/Binrep/Util/ByteOrder.hs +++ b/src/Binrep/Util/ByteOrder.hs @@ -1,5 +1,3 @@ -{-# OPTIONS_GHC -fno-warn-orphans #-} - module Binrep.Util.ByteOrder ( ByteOrder(..), ByteOrdered(..), type EndianSuffix , type LE, type BE, type Endian From 30f9499ea600bc5aaa4c83b5d005fad1816f8b14 Mon Sep 17 00:00:00 2001 From: Ben Orchard Date: Tue, 11 Mar 2025 11:32:58 +0000 Subject: [PATCH 07/10] update nix flake --- flake.lock | 45 ++++++++++++++++++++++++--------------------- flake.nix | 4 ++-- 2 files changed, 26 insertions(+), 23 deletions(-) diff --git a/flake.lock b/flake.lock index faea296..819d2f4 100644 --- a/flake.lock +++ b/flake.lock @@ -21,11 +21,11 @@ "nixpkgs-lib": "nixpkgs-lib" }, "locked": { - "lastModified": 1726153070, - "narHash": "sha256-HO4zgY0ekfwO5bX0QH/3kJ/h4KvUDFZg8YpkNwIbg1U=", + "lastModified": 1741352980, + "narHash": "sha256-+u2UunDA4Cl5Fci3m7S643HzKmIDAe+fiXrLqYsR2fs=", "owner": "hercules-ci", "repo": "flake-parts", - "rev": "bcef6817a8b2aa20a5a6dbb19b43e63c5bf8619a", + "rev": "f4330d22f1c5d2ba72d3d22df5597d123fdb60a9", "type": "github" }, "original": { @@ -36,11 +36,11 @@ }, "haskell-flake": { "locked": { - "lastModified": 1725811060, - "narHash": "sha256-lmPoWYNT8kI8LSTa0Z3id38SoR05+05IEZ3fxeIwOzE=", + "lastModified": 1741528687, + "narHash": "sha256-NPxvw+FaxMPgwGGGiTbmNpfjFhR1HwPRWTBJJufWQ6Q=", "owner": "srid", "repo": "haskell-flake", - "rev": "9b490fe01ec8f6858f43d3cc81bfbbd0000eb29e", + "rev": "f66fe097c01b4ac20a28b4f26e760dffd5891967", "type": "github" }, "original": { @@ -51,11 +51,11 @@ }, "nixpkgs": { "locked": { - "lastModified": 1726042813, - "narHash": "sha256-LnNKCCxnwgF+575y0pxUdlGZBO/ru1CtGHIqQVfvjlA=", + "lastModified": 1741494726, + "narHash": "sha256-OGQeoY72/881aar76xEn4j1BP9s5Ezdi4BxLgYVlqv0=", "owner": "nixos", "repo": "nixpkgs", - "rev": "159be5db480d1df880a0135ca0bfed84c2f88353", + "rev": "9004cb4a05a42b15a6a2eef84acc72152e45ff33", "type": "github" }, "original": { @@ -67,24 +67,27 @@ }, "nixpkgs-lib": { "locked": { - "lastModified": 1725233747, - "narHash": "sha256-Ss8QWLXdr2JCBPcYChJhz4xJm+h/xjl4G0c0XlP6a74=", - "type": "tarball", - "url": "https://github.com/NixOS/nixpkgs/archive/356624c12086a18f2ea2825fed34523d60ccc4e3.tar.gz" + "lastModified": 1740877520, + "narHash": "sha256-oiwv/ZK/2FhGxrCkQkB83i7GnWXPPLzoqFHpDD3uYpk=", + "owner": "nix-community", + "repo": "nixpkgs.lib", + "rev": "147dee35aab2193b174e4c0868bd80ead5ce755c", + "type": "github" }, "original": { - "type": "tarball", - "url": "https://github.com/NixOS/nixpkgs/archive/356624c12086a18f2ea2825fed34523d60ccc4e3.tar.gz" + "owner": "nix-community", + "repo": "nixpkgs.lib", + "type": "github" } }, "rerefined": { "flake": false, "locked": { - "lastModified": 1728746060, - "narHash": "sha256-hF3egnah1V7h59U6PLjSGu+fPyzDmqGWLorhxaBRgzU=", + "lastModified": 1729790883, + "narHash": "sha256-s5zJhJN0au3EBuRWJMZyeFV0Z4ZP6Q0Qy9/piTxS2Xs=", "owner": "raehik", "repo": "rerefined", - "rev": "43c3c5f058f0a7213e957dd54bc73b7fecd1d47e", + "rev": "5e0a616003945a2c22edc77820329b36662240a5", "type": "github" }, "original": { @@ -106,11 +109,11 @@ "strongweak": { "flake": false, "locked": { - "lastModified": 1729166117, - "narHash": "sha256-EluRAlznMM6VEwP8OBrulkglY4vaL2vVtcBNp0AaaHY=", + "lastModified": 1729168115, + "narHash": "sha256-OknVw84t3mbGNyfyAGLq4S1Y6LcnL3m4rzSptT8pkjI=", "owner": "raehik", "repo": "strongweak", - "rev": "f783d1641526ca7dda20ca80ff489fe2f24a1ff2", + "rev": "5d03bda3e6498042cbd062b457f6f002d9f2ada8", "type": "github" }, "original": { diff --git a/flake.nix b/flake.nix index 7cdc785..59b4138 100644 --- a/flake.nix +++ b/flake.nix @@ -41,10 +41,10 @@ settings.defun-core.jailbreak = true; # waiting on nixpkgs update - packages.rerefined.source = inputs.rerefined; + #packages.rerefined.source = inputs.rerefined; settings.strongweak.broken = false; packages.strongweak.source = inputs.strongweak; - packages.bytezap.source = inputs.bytezap; + #packages.bytezap.source = inputs.bytezap; }; haskellProjects.ghc98 = { From 3240bd1271f96e5fc79e17beb98773fb860bc17c Mon Sep 17 00:00:00 2001 From: Ben Orchard Date: Tue, 11 Mar 2025 12:01:48 +0000 Subject: [PATCH 08/10] finish stripping strongweak --- binrep.cabal | 3 --- flake.lock | 19 +------------------ flake.nix | 8 -------- package.yaml | 1 - src/Binrep/Example/Tga.hs | 4 ++++ 5 files changed, 5 insertions(+), 30 deletions(-) diff --git a/binrep.cabal b/binrep.cabal index d68d29e..44fd6ad 100644 --- a/binrep.cabal +++ b/binrep.cabal @@ -100,7 +100,6 @@ library , ghc-bignum ==1.3.* , parser-combinators >=1.3.0 && <1.4 , rerefined >=0.8.0 && <0.9 - , strongweak >=0.11.0 && <0.12 , text >=2.0 && <2.2 , text-builder-linear >=0.1.3 && <0.2 , type-level-bytestrings >=0.1.0 && <0.3 @@ -153,7 +152,6 @@ test-suite spec , parser-combinators >=1.3.0 && <1.4 , quickcheck-instances >=0.3.26 && <0.4 , rerefined >=0.8.0 && <0.9 - , strongweak >=0.11.0 && <0.12 , text >=2.0 && <2.2 , text-builder-linear >=0.1.3 && <0.2 , type-level-bytestrings >=0.1.0 && <0.3 @@ -198,7 +196,6 @@ benchmark bench , ghc-bignum ==1.3.* , parser-combinators >=1.3.0 && <1.4 , rerefined >=0.8.0 && <0.9 - , strongweak >=0.11.0 && <0.12 , text >=2.0 && <2.2 , text-builder-linear >=0.1.3 && <0.2 , type-level-bytestrings >=0.1.0 && <0.3 diff --git a/flake.lock b/flake.lock index 819d2f4..8fd0a17 100644 --- a/flake.lock +++ b/flake.lock @@ -102,24 +102,7 @@ "flake-parts": "flake-parts", "haskell-flake": "haskell-flake", "nixpkgs": "nixpkgs", - "rerefined": "rerefined", - "strongweak": "strongweak" - } - }, - "strongweak": { - "flake": false, - "locked": { - "lastModified": 1729168115, - "narHash": "sha256-OknVw84t3mbGNyfyAGLq4S1Y6LcnL3m4rzSptT8pkjI=", - "owner": "raehik", - "repo": "strongweak", - "rev": "5d03bda3e6498042cbd062b457f6f002d9f2ada8", - "type": "github" - }, - "original": { - "owner": "raehik", - "repo": "strongweak", - "type": "github" + "rerefined": "rerefined" } } }, diff --git a/flake.nix b/flake.nix index 59b4138..dab0b2e 100644 --- a/flake.nix +++ b/flake.nix @@ -7,8 +7,6 @@ rerefined.flake = false; bytezap.url = "github:raehik/bytezap"; bytezap.flake = false; - strongweak.url = "github:raehik/strongweak"; - strongweak.flake = false; }; outputs = inputs: @@ -42,8 +40,6 @@ # waiting on nixpkgs update #packages.rerefined.source = inputs.rerefined; - settings.strongweak.broken = false; - packages.strongweak.source = inputs.strongweak; #packages.bytezap.source = inputs.bytezap; }; @@ -53,8 +49,6 @@ # waiting on nixpkgs update packages.rerefined.source = inputs.rerefined; - settings.strongweak.broken = false; - packages.strongweak.source = inputs.strongweak; packages.bytezap.source = inputs.bytezap; }; @@ -64,8 +58,6 @@ # waiting on nixpkgs update packages.rerefined.source = inputs.rerefined; - settings.strongweak.broken = false; - packages.strongweak.source = inputs.strongweak; packages.bytezap.source = inputs.bytezap; }; }; diff --git a/package.yaml b/package.yaml index 56e4c3b..3ad73e9 100644 --- a/package.yaml +++ b/package.yaml @@ -68,7 +68,6 @@ dependencies: - generic-data-functions ^>= 0.6.0 - generic-type-asserts ^>= 0.3.0 - generic-type-functions ^>= 0.1.0 -- strongweak ^>= 0.11.0 - defun-core ^>= 0.1 # core instances diff --git a/src/Binrep/Example/Tga.hs b/src/Binrep/Example/Tga.hs index 81374b1..05360c6 100644 --- a/src/Binrep/Example/Tga.hs +++ b/src/Binrep/Example/Tga.hs @@ -1,5 +1,7 @@ module Binrep.Example.Tga where +{- + {- import Binrep import Binrep.Type.Derived.NullTermPadded @@ -26,3 +28,5 @@ data ImageType | RLEColorMapped | RLETrueColor | RLEBW + +-} From e30213d48cc22ff52f828624090eaa082b72ed5d Mon Sep 17 00:00:00 2001 From: Ben Orchard Date: Tue, 11 Mar 2025 12:07:58 +0000 Subject: [PATCH 09/10] update changelog; tweak Nix flake --- CHANGELOG.md | 6 +++--- flake.lock | 36 +----------------------------------- flake.nix | 16 ---------------- 3 files changed, 4 insertions(+), 54 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index bc31c21..bc6806e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,7 +1,7 @@ ## 1.1.0 (unreleased) -* fix ByteOrdered orphan strongweak instances to follow strongweak pattern -- - for original behaviour, use `WeakenN 2 (ByteOrdered end a)` -* update rerefined, strongweak +* remove strongweak integration + * to be released in separate package binrep-instances +* update rerefined ## 1.0.0 (2024-10-03) * fix `NullTerminate` check being inverted (OOPS LOL) diff --git a/flake.lock b/flake.lock index 8fd0a17..671d957 100644 --- a/flake.lock +++ b/flake.lock @@ -1,21 +1,5 @@ { "nodes": { - "bytezap": { - "flake": false, - "locked": { - "lastModified": 1727486916, - "narHash": "sha256-C7Lo/8stL35tVAFNN1Ab2Hpyp8qoxJNf84BNLtZOGWE=", - "owner": "raehik", - "repo": "bytezap", - "rev": "0970bfe3a6e660544c73e76ac377a4a836a8ab28", - "type": "github" - }, - "original": { - "owner": "raehik", - "repo": "bytezap", - "type": "github" - } - }, "flake-parts": { "inputs": { "nixpkgs-lib": "nixpkgs-lib" @@ -80,29 +64,11 @@ "type": "github" } }, - "rerefined": { - "flake": false, - "locked": { - "lastModified": 1729790883, - "narHash": "sha256-s5zJhJN0au3EBuRWJMZyeFV0Z4ZP6Q0Qy9/piTxS2Xs=", - "owner": "raehik", - "repo": "rerefined", - "rev": "5e0a616003945a2c22edc77820329b36662240a5", - "type": "github" - }, - "original": { - "owner": "raehik", - "repo": "rerefined", - "type": "github" - } - }, "root": { "inputs": { - "bytezap": "bytezap", "flake-parts": "flake-parts", "haskell-flake": "haskell-flake", - "nixpkgs": "nixpkgs", - "rerefined": "rerefined" + "nixpkgs": "nixpkgs" } } }, diff --git a/flake.nix b/flake.nix index dab0b2e..f5f3d44 100644 --- a/flake.nix +++ b/flake.nix @@ -3,10 +3,6 @@ nixpkgs.url = "github:nixos/nixpkgs/nixpkgs-unstable"; flake-parts.url = "github:hercules-ci/flake-parts"; haskell-flake.url = "github:srid/haskell-flake"; - rerefined.url = "github:raehik/rerefined"; - rerefined.flake = false; - bytezap.url = "github:raehik/bytezap"; - bytezap.flake = false; }; outputs = inputs: @@ -37,28 +33,16 @@ # https://github.com/phadej/defun/pull/5 settings.defun-core.jailbreak = true; - - # waiting on nixpkgs update - #packages.rerefined.source = inputs.rerefined; - #packages.bytezap.source = inputs.bytezap; }; haskellProjects.ghc98 = { basePackages = pkgs.haskell.packages.ghc98; devShell = defDevShell "ghc98"; - - # waiting on nixpkgs update - packages.rerefined.source = inputs.rerefined; - packages.bytezap.source = inputs.bytezap; }; haskellProjects.ghc96 = { basePackages = pkgs.haskell.packages.ghc96; devShell = defDevShell "ghc96"; - - # waiting on nixpkgs update - packages.rerefined.source = inputs.rerefined; - packages.bytezap.source = inputs.bytezap; }; }; }; From 5c2ae5112165f5acdaae9a4c49dfe4e56e2dc4f7 Mon Sep 17 00:00:00 2001 From: Ben Orchard Date: Tue, 11 Mar 2025 12:08:57 +0000 Subject: [PATCH 10/10] release 1.1.0 --- CHANGELOG.md | 2 +- LICENSE | 2 +- binrep.cabal | 2 +- package.yaml | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index bc6806e..1630ec8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,4 +1,4 @@ -## 1.1.0 (unreleased) +## 1.1.0 (2025-03-11) * remove strongweak integration * to be released in separate package binrep-instances * update rerefined diff --git a/LICENSE b/LICENSE index c970cd0..237644d 100644 --- a/LICENSE +++ b/LICENSE @@ -1,4 +1,4 @@ -Copyright (c) 2022-2024 Ben Orchard (@raehik) +Copyright (c) 2022-2025 Ben Orchard (@raehik) Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the diff --git a/binrep.cabal b/binrep.cabal index 44fd6ad..ead3d68 100644 --- a/binrep.cabal +++ b/binrep.cabal @@ -5,7 +5,7 @@ cabal-version: 1.12 -- see: https://github.com/sol/hpack name: binrep -version: 1.0.0 +version: 1.1.0 synopsis: Encode precise binary representations directly in types description: Please see README.md. category: Data, Serialization, Generics diff --git a/package.yaml b/package.yaml index 3ad73e9..3d1718a 100644 --- a/package.yaml +++ b/package.yaml @@ -1,5 +1,5 @@ name: binrep -version: 1.0.0 +version: 1.1.0 synopsis: Encode precise binary representations directly in types description: Please see README.md. extra-source-files: