Skip to content

Use the TESTING macro less #1084

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jan 10, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Use the TESTING define less
It's not necessary to use it for conditional exports or SafeHaskell.
  • Loading branch information
meooow25 committed Jan 2, 2025
commit 4a856a2731bdd80cc69c23631c01b9e70bf4d305
1 change: 1 addition & 0 deletions containers-tests/tests/set-properties.hs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import Data.List (nub, sort, sortBy)
import qualified Data.List as List
import Data.Maybe
import Data.Set
import Data.Set.Internal (link, merge)
import Prelude hiding (lookup, null, map, filter, foldr, foldl, foldl', all, take, drop, splitAt)
import Test.Tasty
import Test.Tasty.HUnit
Expand Down
2 changes: 1 addition & 1 deletion containers/src/Data/IntMap.hs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{-# LANGUAGE CPP #-}
#if !defined(TESTING) && defined(__GLASGOW_HASKELL__)
#ifdef __GLASGOW_HASKELL__
{-# LANGUAGE Safe #-}
#endif

Expand Down
2 changes: 0 additions & 2 deletions containers/src/Data/IntMap/Internal.hs
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE StandaloneDeriving #-}
{-# LANGUAGE TypeFamilies #-}
#endif
#if !defined(TESTING) && defined(__GLASGOW_HASKELL__)
{-# LANGUAGE Trustworthy #-}
#endif

Expand Down
6 changes: 1 addition & 5 deletions containers/src/Data/IntMap/Lazy.hs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{-# LANGUAGE CPP #-}
#if !defined(TESTING) && defined(__GLASGOW_HASKELL__)
#ifdef __GLASGOW_HASKELL__
{-# LANGUAGE Safe #-}
#endif

Expand Down Expand Up @@ -70,11 +70,7 @@

module Data.IntMap.Lazy (
-- * Map type
#if !defined(TESTING)
IntMap, Key -- instance Eq,Show
#else
IntMap(..), Key -- instance Eq,Show
#endif

-- * Construction
, empty
Expand Down
2 changes: 1 addition & 1 deletion containers/src/Data/IntMap/Merge/Lazy.hs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{-# LANGUAGE CPP #-}
#if !defined(TESTING) && defined(__GLASGOW_HASKELL__)
#ifdef __GLASGOW_HASKELL__
{-# LANGUAGE Safe #-}
#endif

Expand Down
2 changes: 1 addition & 1 deletion containers/src/Data/IntMap/Merge/Strict.hs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{-# LANGUAGE CPP #-}
{-# LANGUAGE BangPatterns #-}
#if !defined(TESTING) && defined(__GLASGOW_HASKELL__)
#ifdef __GLASGOW_HASKELL__
{-# LANGUAGE Trustworthy #-}
#endif

Expand Down
6 changes: 1 addition & 5 deletions containers/src/Data/IntMap/Strict.hs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{-# LANGUAGE CPP #-}
#if !defined(TESTING) && defined(__GLASGOW_HASKELL__)
#ifdef __GLASGOW_HASKELL__
{-# LANGUAGE Trustworthy #-}
#endif

Expand Down Expand Up @@ -88,11 +88,7 @@

module Data.IntMap.Strict (
-- * Map type
#if !defined(TESTING)
IntMap, Key -- instance Eq,Show
#else
IntMap(..), Key -- instance Eq,Show
#endif

-- * Construction
, empty
Expand Down
4 changes: 0 additions & 4 deletions containers/src/Data/IntMap/Strict/Internal.hs
Original file line number Diff line number Diff line change
Expand Up @@ -86,11 +86,7 @@

module Data.IntMap.Strict.Internal (
-- * Map type
#if !defined(TESTING)
IntMap, Key -- instance Eq,Show
#else
IntMap(..), Key -- instance Eq,Show
#endif

-- * Construction
, empty
Expand Down
6 changes: 1 addition & 5 deletions containers/src/Data/IntSet.hs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{-# LANGUAGE CPP #-}
#if !defined(TESTING) && defined(__GLASGOW_HASKELL__)
#ifdef __GLASGOW_HASKELL__
{-# LANGUAGE Safe #-}
#endif

Expand Down Expand Up @@ -66,11 +66,7 @@

module Data.IntSet (
-- * Set type
#if !defined(TESTING)
IntSet -- instance Eq,Show
#else
IntSet(..) -- instance Eq,Show
#endif
, Key

-- * Construction
Expand Down
2 changes: 0 additions & 2 deletions containers/src/Data/IntSet/Internal.hs
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@
{-# LANGUAGE MagicHash #-}
{-# LANGUAGE StandaloneDeriving #-}
{-# LANGUAGE TypeFamilies #-}
#endif
#if !defined(TESTING) && defined(__GLASGOW_HASKELL__)
{-# LANGUAGE Trustworthy #-}
#endif

Expand Down
2 changes: 1 addition & 1 deletion containers/src/Data/Map.hs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{-# LANGUAGE CPP #-}
#if !defined(TESTING) && defined(__GLASGOW_HASKELL__)
#ifdef __GLASGOW_HASKELL__
{-# LANGUAGE Safe #-}
#endif

Expand Down
2 changes: 1 addition & 1 deletion containers/src/Data/Map/Merge/Strict.hs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{-# LANGUAGE CPP #-}
#if defined(__GLASGOW_HASKELL__)
#ifdef __GLASGOW_HASKELL__
{-# LANGUAGE Safe #-}
#endif

Expand Down
14 changes: 1 addition & 13 deletions containers/src/Data/Set.hs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{-# LANGUAGE CPP #-}
#if !defined(TESTING) && defined(__GLASGOW_HASKELL__)
#ifdef __GLASGOW_HASKELL__
{-# LANGUAGE Safe #-}
#endif

Expand Down Expand Up @@ -72,11 +72,7 @@

module Data.Set (
-- * Set type
#if !defined(TESTING)
Set -- instance Eq,Ord,Show,Read,Data
#else
Set(..)
#endif

-- * Construction
, empty
Expand Down Expand Up @@ -179,14 +175,6 @@ module Data.Set (
, showTree
, showTreeWith
, valid

#if defined(TESTING)
-- Internals (for testing)
, bin
, balanced
, link
, merge
#endif
) where

import Data.Set.Internal as S
4 changes: 1 addition & 3 deletions containers/src/Data/Set/Internal.hs
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
{-# LANGUAGE CPP #-}
{-# LANGUAGE BangPatterns #-}
{-# LANGUAGE PatternGuards #-}
#if !defined(TESTING) && defined(__GLASGOW_HASKELL__)
{-# LANGUAGE Trustworthy #-}
#endif
#ifdef __GLASGOW_HASKELL__
{-# LANGUAGE Trustworthy #-}
{-# LANGUAGE DeriveLift #-}
{-# LANGUAGE RoleAnnotations #-}
{-# LANGUAGE StandaloneDeriving #-}
Expand Down
2 changes: 1 addition & 1 deletion containers/src/Utils/Containers/Internal/StrictPair.hs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{-# LANGUAGE CPP #-}
#if !defined(TESTING) && defined(__GLASGOW_HASKELL__)
#ifdef __GLASGOW_HASKELL__
{-# LANGUAGE Safe #-}
#endif

Expand Down
10 changes: 2 additions & 8 deletions containers/src/Utils/Containers/Internal/TypeError.hs
Original file line number Diff line number Diff line change
@@ -1,14 +1,12 @@
{-# LANGUAGE DataKinds, FlexibleInstances, FlexibleContexts, UndecidableInstances,
KindSignatures, TypeFamilies, CPP #-}

#if !defined(TESTING)
{-# LANGUAGE Safe #-}
#endif

-- | Unsatisfiable constraints for functions being removed.

-- This module is GHC-only.
module Utils.Containers.Internal.TypeError where
#ifdef __GLASGOW_HASKELL__

import GHC.TypeLits

-- | The constraint @Whoops s@ is unsatisfiable for every 'Symbol' @s@. Trying
Expand Down Expand Up @@ -43,7 +41,3 @@ instance TypeError ('Text a) => Whoops a
-- reducing the constraint because it knows someone could (theoretically)
-- define an overlapping instance of Whoops. It doesn't commit to
-- the polymorphic one until it has to, at the call site.

#else
class Whoops (a :: Symbol)
#endif
Loading