Skip to content

Commit

Permalink
Update QSM, remove Sing and Dict (#885)
Browse files Browse the repository at this point in the history
  • Loading branch information
jasagredo authored Jan 18, 2024
2 parents a4ebd72 + 3e56f60 commit ceada55
Show file tree
Hide file tree
Showing 19 changed files with 101 additions and 162 deletions.
5 changes: 5 additions & 0 deletions .hlint.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,12 @@
, as: [CSC, CsClient, CSClient]
, message: "Exports fields with very common names"
}
- { name: Data.SOP.Dict
, importStyle: explicitOrQualified
, message: "Avoid confusion with Data.Constraint (Dict)"
}

- ignore: {}

- warn: {name: Ouroboros.Consensus.MiniProtocol.ChainSync.Client should be imported qualified or with an explicit import list}
- error: {name: Data.SOP.Dict should be imported qualified or with an explicit import list}
10 changes: 1 addition & 9 deletions cabal.project
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ repository cardano-haskell-packages
-- update either of these.
index-state:
-- Bump this if you need newer packages from Hackage
, hackage.haskell.org 2023-12-14T23:57:38Z
, hackage.haskell.org 2024-01-16T12:10:07Z
-- Bump this if you need newer packages from CHaP
, cardano-haskell-packages 2023-12-15T13:02:57Z

Expand All @@ -31,11 +31,3 @@ tests: true
benchmarks: true

import: ./asserts.cabal

-- Remove once QSM 0.9 is released, see
-- https://github.com/stevana/quickcheck-state-machine/pull/31
source-repository-package
type: git
location: https://github.com/stevana/quickcheck-state-machine
tag: 8e2bfb2214c7af1dae728180f2092effea6fbeb7
--sha256: sha256-SRcuyKs0Sz+GBsCKE16LSnH14p3q8ZLxkcVyfErvfPQ=
6 changes: 3 additions & 3 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions ouroboros-consensus-cardano/ouroboros-consensus-cardano.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -247,6 +247,7 @@ test-suite byron-test
, cardano-ledger-byron
, cardano-ledger-byron-test
, cborg
, constraints
, containers
, filepath
, hedgehog-quickcheck
Expand Down Expand Up @@ -328,6 +329,7 @@ test-suite shelley-test
, cardano-protocol-tpraos
, cardano-slotting
, cborg
, constraints
, containers
, filepath
, microlens
Expand Down Expand Up @@ -420,6 +422,7 @@ test-suite cardano-test
, cardano-protocol-tpraos
, cardano-slotting
, cborg
, constraints
, containers
, contra-tracer
, filepath
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,14 @@ import qualified Cardano.Chain.Block as CC.Block
import qualified Cardano.Chain.Update as CC.Update
import Codec.CBOR.Write (toLazyByteString)
import qualified Data.ByteString.Lazy as Lazy
import Data.Constraint
import Ouroboros.Consensus.Byron.Ledger
import Ouroboros.Consensus.Byron.Node
import Ouroboros.Consensus.Config
import qualified Ouroboros.Consensus.Mempool as Mempool
import Ouroboros.Consensus.Node.ProtocolInfo
import Ouroboros.Consensus.Node.Serialisation ()
import Ouroboros.Consensus.Storage.Common (BinaryBlockInfo (..))
import Ouroboros.Consensus.Util (Dict (..))
import qualified Test.Cardano.Chain.Genesis.Dummy as CC
import Test.Consensus.Byron.Generators
import Test.QuickCheck hiding (Result)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ module Test.Consensus.Cardano.Serialisation (tests) where

import qualified Codec.CBOR.Write as CBOR
import qualified Data.ByteString.Lazy as Lazy
import Data.Constraint
import Ouroboros.Consensus.Block
import Ouroboros.Consensus.Byron.Ledger
import Ouroboros.Consensus.Byron.Node ()
Expand All @@ -17,7 +18,6 @@ import Ouroboros.Consensus.HardFork.Combinator.Block
import Ouroboros.Consensus.Shelley.Ledger
import Ouroboros.Consensus.Shelley.Node ()
import Ouroboros.Consensus.Storage.Serialisation
import Ouroboros.Consensus.Util (Dict (..))
import Ouroboros.Network.Block (Serialised (..))
import qualified Test.Consensus.Cardano.Examples as Cardano.Examples
import Test.Consensus.Cardano.Generators (epochSlots)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ module Test.Consensus.Shelley.Serialisation (tests) where
import Cardano.Crypto.Hash (ShortHash)
import qualified Codec.CBOR.Write as CBOR
import qualified Data.ByteString.Lazy as Lazy
import Data.Constraint
import Data.Proxy (Proxy (..))
import Data.Word (Word64)
import Ouroboros.Consensus.Protocol.TPraos (TPraos)
Expand All @@ -18,7 +19,6 @@ import Ouroboros.Consensus.Shelley.Node ()
import Ouroboros.Consensus.Shelley.Node.Serialisation ()
import Ouroboros.Consensus.Shelley.Protocol.TPraos ()
import Ouroboros.Consensus.Storage.Common (BinaryBlockInfo (..))
import Ouroboros.Consensus.Util (Dict (..))
import Test.Consensus.Shelley.Generators ()
import Test.Consensus.Shelley.MockCrypto
import Test.Tasty
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,7 @@ test-suite mock-test
, base
, bytestring
, cborg
, constraints
, containers
, ouroboros-consensus:{ouroboros-consensus, unstable-consensus-testlib, unstable-mock-block}
, ouroboros-network-mock
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

module Test.ThreadNet.BFT (tests) where

import Data.Constraint
import Ouroboros.Consensus.Block
import Ouroboros.Consensus.BlockchainTime
import Ouroboros.Consensus.Config.SecurityParam
Expand All @@ -13,7 +14,6 @@ import Ouroboros.Consensus.Mock.Ledger
import Ouroboros.Consensus.Mock.Node ()
import Ouroboros.Consensus.Mock.Node.BFT
import Ouroboros.Consensus.Mock.Node.Serialisation
import Ouroboros.Consensus.Util (Dict (..))
import Test.Consensus.Ledger.Mock.Generators ()
import Test.QuickCheck
import Test.Tasty
Expand Down
6 changes: 3 additions & 3 deletions ouroboros-consensus/ouroboros-consensus.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,6 @@ library
Ouroboros.Consensus.Util.Orphans
Ouroboros.Consensus.Util.RedundantConstraints
Ouroboros.Consensus.Util.ResourceRegistry
Ouroboros.Consensus.Util.Singletons
Ouroboros.Consensus.Util.STM
Ouroboros.Consensus.Util.TentativeState
Ouroboros.Consensus.Util.Time
Expand Down Expand Up @@ -362,6 +361,7 @@ library unstable-consensus-testlib
, cardano-prelude
, cardano-strict-containers
, cborg
, constraints
, containers
, contra-tracer
, deepseq
Expand All @@ -381,7 +381,7 @@ library unstable-consensus-testlib
, ouroboros-network-mock
, pretty-simple
, QuickCheck
, quickcheck-state-machine:no-vendored-treediff ^>=0.8
, quickcheck-state-machine:no-vendored-treediff ^>=0.9
, quiet
, random
, serialise
Expand Down Expand Up @@ -625,7 +625,7 @@ test-suite storage-test
, ouroboros-network-mock
, pretty-show
, QuickCheck
, quickcheck-state-machine:no-vendored-treediff ^>=0.8
, quickcheck-state-machine:no-vendored-treediff ^>=0.9
, random
, serialise
, tasty
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import Data.List (intercalate)
import Data.Proxy
import Data.SOP.BasicFunctors
import Data.SOP.Constraint
import Data.SOP.Dict
import Data.SOP.Dict (Dict (..), all_NP, unAll_NP)
import Data.SOP.Match (Mismatch)
import Data.SOP.OptNP (OptNP (..))
import Data.SOP.Sing
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ module Ouroboros.Consensus.HardFork.Combinator.Protocol.LedgerView (

import Data.SOP.BasicFunctors
import Data.SOP.Constraint
import Data.SOP.Dict
import Data.SOP.Dict (Dict (..), all_NP)
import Data.SOP.Strict
import Ouroboros.Consensus.HardFork.Combinator.Abstract
import Ouroboros.Consensus.HardFork.Combinator.State.Instances ()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import Codec.CBOR.Encoding (Encoding)
import qualified Data.ByteString.Lazy as Lazy
import Data.SOP.BasicFunctors
import Data.SOP.Constraint
import Data.SOP.Dict
import Data.SOP.Dict (Dict (..), all_NP)
import Data.SOP.Strict
import Ouroboros.Consensus.Block
import Ouroboros.Consensus.HardFork.Combinator.AcrossEras
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,7 @@
-- | Miscellaneous utilities
module Ouroboros.Consensus.Util (
-- * Type-level utility
Dict (..)
, Empty
Empty
, ShowProxy (..)
, Some (..)
, SomePair (..)
Expand Down Expand Up @@ -75,7 +74,7 @@ import Data.Foldable (asum, toList)
import Data.Function (on)
import Data.Functor.Identity
import Data.Functor.Product
import Data.Kind (Constraint, Type)
import Data.Kind (Type)
import Data.List (foldl', maximumBy)
import Data.List.NonEmpty (NonEmpty (..), (<|))
import Data.Maybe (fromMaybe)
Expand All @@ -90,9 +89,6 @@ import Ouroboros.Network.Util.ShowProxy (ShowProxy (..))
Type-level utility
-------------------------------------------------------------------------------}

data Dict :: Constraint -> Type where
Dict :: a => Dict a

class Empty a
instance Empty a

Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ import qualified Data.ByteString.Base16.Lazy as Base16
import qualified Data.ByteString.Lazy as Lazy
import qualified Data.ByteString.Lazy.Char8 as Char8
import qualified Data.ByteString.Short as Short
import Data.Constraint
import Data.Function (on)
import Data.Maybe (fromMaybe)
import qualified Data.Text.Lazy as T
Expand All @@ -72,7 +73,6 @@ import Ouroboros.Consensus.Node.Serialisation
import Ouroboros.Consensus.Protocol.Abstract (ChainDepState)
import Ouroboros.Consensus.Storage.ChainDB (SerialiseDiskConstraints)
import Ouroboros.Consensus.Storage.Serialisation
import Ouroboros.Consensus.Util (Dict (..))
import Ouroboros.Network.Block (Serialised (..), fromSerialised,
mkSerialised)
import Quiet (Quiet (..))
Expand Down
Loading

0 comments on commit ceada55

Please sign in to comment.