diff --git a/lib/primitive/cardano-wallet-primitive.cabal b/lib/primitive/cardano-wallet-primitive.cabal index 23db94816ff..21d3ee84f42 100644 --- a/lib/primitive/cardano-wallet-primitive.cabal +++ b/lib/primitive/cardano-wallet-primitive.cabal @@ -158,13 +158,10 @@ test-suite test Cardano.Wallet.Primitive.Types.HashSpec Cardano.Wallet.Primitive.Types.TokenBundleSpec Cardano.Wallet.Primitive.Types.TokenMapSpec - Cardano.Wallet.Primitive.Types.TokenMapSpec.TypeErrorSpec Cardano.Wallet.Primitive.Types.TokenPolicySpec Cardano.Wallet.Primitive.Types.TokenQuantitySpec - Cardano.Wallet.Primitive.Types.UTxOIndex.TypeErrorSpec Cardano.Wallet.Primitive.Types.UTxOIndexSpec Cardano.Wallet.Primitive.Types.UTxOSelectionSpec - Cardano.Wallet.Primitive.Types.UTxOSelectionSpec.TypeErrorSpec Cardano.Wallet.Primitive.Types.UTxOSpec Data.QuantitySpec Spec diff --git a/lib/primitive/test/spec/Cardano/Wallet/Primitive/Types/TokenMapSpec/TypeErrorSpec.hs b/lib/primitive/test/spec/Cardano/Wallet/Primitive/Types/TokenMapSpec/TypeErrorSpec.hs deleted file mode 100644 index aedf2c1465b..00000000000 --- a/lib/primitive/test/spec/Cardano/Wallet/Primitive/Types/TokenMapSpec/TypeErrorSpec.hs +++ /dev/null @@ -1,39 +0,0 @@ -{-# OPTIONS_GHC -fdefer-type-errors #-} -{-# OPTIONS_GHC -fno-warn-deferred-out-of-scope-variables #-} -{-# OPTIONS_GHC -fno-warn-deferred-type-errors #-} -{-# OPTIONS_GHC -fno-warn-dodgy-imports #-} -{-# OPTIONS_GHC -fno-warn-unused-imports #-} - -module Cardano.Wallet.Primitive.Types.TokenMapSpec.TypeErrorSpec - ( spec - ) where - -import Prelude - -import Cardano.Wallet.Primitive.Types.TokenMap - ( TokenMap (..) ) -import Test.Hspec - ( Expectation, Spec, describe, it ) -import Test.ShouldNotTypecheck - ( shouldNotTypecheck ) - -spec :: Spec -spec = describe "Token map type error tests" $ - - it "Default data constructor is not exported" - testDefaultDataConstructorNotExported - --- Test that the default data constructor for 'TokenMap' is not exported. --- --- The default data constructor for 'TokenMap' is not exported, by design, as --- the internal data structure has an invariant that must be preserved across --- all operations. --- --- Exporting the default constructor would make it possible for functions --- outside the 'TokenMap' module to break the invariant, opening the door to --- subtle regressions. --- --- See the definition of 'TokenMap' for more details of the invariant. --- -testDefaultDataConstructorNotExported :: Expectation -testDefaultDataConstructorNotExported = shouldNotTypecheck (TokenMap mempty) diff --git a/lib/primitive/test/spec/Cardano/Wallet/Primitive/Types/UTxOIndex/TypeErrorSpec.hs b/lib/primitive/test/spec/Cardano/Wallet/Primitive/Types/UTxOIndex/TypeErrorSpec.hs deleted file mode 100644 index 9cf88d68a11..00000000000 --- a/lib/primitive/test/spec/Cardano/Wallet/Primitive/Types/UTxOIndex/TypeErrorSpec.hs +++ /dev/null @@ -1,40 +0,0 @@ -{-# OPTIONS_GHC -fdefer-type-errors #-} -{-# OPTIONS_GHC -fno-warn-deferred-out-of-scope-variables #-} -{-# OPTIONS_GHC -fno-warn-deferred-type-errors #-} -{-# OPTIONS_GHC -fno-warn-dodgy-imports #-} -{-# OPTIONS_GHC -fno-warn-unused-imports #-} - -module Cardano.Wallet.Primitive.Types.UTxOIndex.TypeErrorSpec - ( spec - ) where - -import Prelude - -import Cardano.Wallet.Primitive.Types.UTxOIndex.Internal - ( UTxOIndex (..) ) -import Test.Hspec - ( Expectation, Spec, describe, it ) -import Test.ShouldNotTypecheck - ( shouldNotTypecheck ) - -spec :: Spec -spec = describe "UTxO index type error tests" $ - - it "Default data constructor is not exported" - testDefaultDataConstructorNotExported - --- Test that the default data constructor for 'UTxOIndex' is not exported. --- --- The default data constructor for 'UTxOIndex' is not exported, by design, as --- the internal data structure has an invariant that must be preserved across --- all operations. --- --- Exporting the default constructor would make it possible for functions --- outside the 'UTxOIndex' module to break the invariant, opening the door to --- subtle regressions. --- --- See the definition of 'UTxOIndex' for more details of the invariant. --- -testDefaultDataConstructorNotExported :: Expectation -testDefaultDataConstructorNotExported = - shouldNotTypecheck UTxOIndex diff --git a/lib/primitive/test/spec/Cardano/Wallet/Primitive/Types/UTxOSelectionSpec/TypeErrorSpec.hs b/lib/primitive/test/spec/Cardano/Wallet/Primitive/Types/UTxOSelectionSpec/TypeErrorSpec.hs deleted file mode 100644 index e558fef8f62..00000000000 --- a/lib/primitive/test/spec/Cardano/Wallet/Primitive/Types/UTxOSelectionSpec/TypeErrorSpec.hs +++ /dev/null @@ -1,43 +0,0 @@ -{-# OPTIONS_GHC -fdefer-type-errors #-} -{-# OPTIONS_GHC -fno-warn-deferred-out-of-scope-variables #-} -{-# OPTIONS_GHC -fno-warn-deferred-type-errors #-} -{-# OPTIONS_GHC -fno-warn-dodgy-imports #-} -{-# OPTIONS_GHC -fno-warn-unused-imports #-} - -module Cardano.Wallet.Primitive.Types.UTxOSelectionSpec.TypeErrorSpec - ( spec - ) where - -import Prelude - -import Cardano.Wallet.Primitive.Types.UTxOSelection - ( UTxOSelection (..), UTxOSelectionNonEmpty (..) ) -import Test.Hspec - ( Expectation, Spec, describe, it ) -import Test.ShouldNotTypecheck - ( shouldNotTypecheck ) - --- The data constructors for 'UTxOSelection' and 'UTxOSelectionNonEmpty' are --- not exported, by design, as their internal data structures have invariants --- that must be preserved across all operations. --- --- Exporting these constructors would make it possible for functions outside --- the 'UTxOSelection' module to break these invariants. --- --- Therefore, we test here that they are not exported. --- -spec :: Spec -spec = describe "UTxOSelection type error tests" $ do - - it "Data constructor is not exported for UTxOSelection" - testDataConstructorNotExportedForUTxOSelection - it "Data constructor is not exported for UTxOSelectionNonEmpty" - testDataConstructorNotExportedForUTxOSelectionNonEmpty - -testDataConstructorNotExportedForUTxOSelection :: Expectation -testDataConstructorNotExportedForUTxOSelection = - shouldNotTypecheck UTxOSelection - -testDataConstructorNotExportedForUTxOSelectionNonEmpty :: Expectation -testDataConstructorNotExportedForUTxOSelectionNonEmpty = - shouldNotTypecheck UTxOSelectionNonEmpty diff --git a/lib/strict-non-empty-containers/strict-non-empty-containers.cabal b/lib/strict-non-empty-containers/strict-non-empty-containers.cabal index e7a1c9d4b42..48ae79939ff 100644 --- a/lib/strict-non-empty-containers/strict-non-empty-containers.cabal +++ b/lib/strict-non-empty-containers/strict-non-empty-containers.cabal @@ -70,4 +70,3 @@ test-suite unit Main.hs other-modules: Data.Map.Strict.NonEmptyMapSpec - Data.Map.Strict.NonEmptyMap.TypeErrorSpec diff --git a/lib/strict-non-empty-containers/test/unit/Data/Map/Strict/NonEmptyMap/TypeErrorSpec.hs b/lib/strict-non-empty-containers/test/unit/Data/Map/Strict/NonEmptyMap/TypeErrorSpec.hs deleted file mode 100644 index 4dd3ca47292..00000000000 --- a/lib/strict-non-empty-containers/test/unit/Data/Map/Strict/NonEmptyMap/TypeErrorSpec.hs +++ /dev/null @@ -1,40 +0,0 @@ -{-# OPTIONS_GHC -fdefer-type-errors #-} -{-# OPTIONS_GHC -fno-warn-deferred-out-of-scope-variables #-} -{-# OPTIONS_GHC -fno-warn-deferred-type-errors #-} -{-# OPTIONS_GHC -fno-warn-dodgy-imports #-} -{-# OPTIONS_GHC -fno-warn-unused-imports #-} - -module Data.Map.Strict.NonEmptyMap.TypeErrorSpec - ( spec - ) where - -import Prelude - -import Data.Map.Strict.NonEmptyMap.Internal - ( NonEmptyMap (..) ) -import Test.Hspec - ( Expectation, Spec, describe, it ) -import Test.ShouldNotTypecheck - ( shouldNotTypecheck ) - -spec :: Spec -spec = describe "Strict non-empty map type error tests" $ - - it "Default data constructor is not exported" - testDefaultDataConstructorNotExported - --- Test that the default data constructor for 'NonEmptyMap' is not exported. --- --- The default data constructor for 'NonEmptyMap' is not exported, by design, --- as the internal data structure has an invariant that must be preserved --- across all operations. --- --- Exporting the default data constructor would make it possible for functions --- in external modules to break the invariant, opening the door to subtle --- regressions. --- --- See the definition of 'NonEmptyMap' for more details of the invariant. --- -testDefaultDataConstructorNotExported :: Expectation -testDefaultDataConstructorNotExported = - shouldNotTypecheck $ NonEmptyMap ((), ()) mempty