From 4b4db5d7b4ddda430050ad384f67ff03ed86605f Mon Sep 17 00:00:00 2001 From: Ryan Scott Date: Thu, 6 Feb 2020 10:02:34 -0500 Subject: [PATCH] Remove the promoted versions of GenericTake et al. Per the discussion in https://github.com/goldfirere/singletons/issues/433#issuecomment-582912446, these definitions are subtly bogus. Let's just remove them. --- CHANGES.md | 5 +++++ src/Data/Singletons/Prelude/List.hs | 9 +------- src/Data/Singletons/Prelude/List/Internal.hs | 22 -------------------- 3 files changed, 6 insertions(+), 30 deletions(-) diff --git a/CHANGES.md b/CHANGES.md index 66d7e347..bef8273d 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -34,6 +34,11 @@ Changelog for singletons project * Export `ApplyTyConAux1`, `ApplyTyConAux2`, as well as the record pattern synonyms selector `applySing2`, `applySing3`, etc. from `Data.Singletons`. These were unintentionally left out in previous releases. +* Remove the promoted versions of `genericTake`, `genericDrop`, + `genericSplitAt`, `genericIndex`, and `genericReplicate` from + `Data.Singletons.Prelude.List`. These definitions were subtly wrong since + (1) they claim to work over any `Integral` type `i`, but in practice would + only work on `Nat`s, and (2) wouldn't even typecheck if they were singled. * Fix a slew of bugs related to fixity declarations: * Fixity declarations for data types are no longer singled, as fixity declarations do not serve any purpose for singled data type constructors, diff --git a/src/Data/Singletons/Prelude/List.hs b/src/Data/Singletons/Prelude/List.hs index 80ddea71..39cb0974 100644 --- a/src/Data/Singletons/Prelude/List.hs +++ b/src/Data/Singletons/Prelude/List.hs @@ -124,8 +124,6 @@ module Data.Singletons.Prelude.List ( -- | The prefix \`@generic@\' indicates an overloaded function that -- is a generalized version of a "Prelude" function. GenericLength, sGenericLength, - GenericTake, GenericDrop, - GenericSplitAt, GenericIndex, GenericReplicate, -- * Defunctionalization symbols NilSym0, @@ -245,12 +243,7 @@ module Data.Singletons.Prelude.List ( MaximumBySym0, MaximumBySym1, MaximumBySym2, MinimumBySym0, MinimumBySym1, MinimumBySym2, - GenericLengthSym0, GenericLengthSym1, - GenericTakeSym0, GenericTakeSym1, GenericTakeSym2, - GenericDropSym0, GenericDropSym1, GenericDropSym2, - GenericSplitAtSym0, GenericSplitAtSym1, GenericSplitAtSym2, - GenericIndexSym0, GenericIndexSym1, GenericIndexSym2, - GenericReplicateSym0, GenericReplicateSym1, GenericReplicateSym2, + GenericLengthSym0, GenericLengthSym1 ) where import Data.Singletons.Prelude.Base diff --git a/src/Data/Singletons/Prelude/List/Internal.hs b/src/Data/Singletons/Prelude/List/Internal.hs index 6e3295c1..fd5b72ed 100644 --- a/src/Data/Singletons/Prelude/List/Internal.hs +++ b/src/Data/Singletons/Prelude/List/Internal.hs @@ -637,26 +637,4 @@ $(promoteOnly [d| zipWith7 z (a:as) (b:bs) (c:cs) (d:ds) (e:es) (f:fs) (g:gs) = z a b c d e f g : zipWith7 z as bs cs ds es fs gs zipWith7 _ _ _ _ _ _ _ _ = [] - --- These functions use Integral or Num typeclass instead of Int. --- --- genericLength, genericTake, genericDrop, genericSplitAt, genericIndex --- genericReplicate --- --- We provide aliases below to improve compatibility - - genericTake :: (Integral i) => i -> [a] -> [a] - genericTake = take - - genericDrop :: (Integral i) => i -> [a] -> [a] - genericDrop = drop - - genericSplitAt :: (Integral i) => i -> [a] -> ([a], [a]) - genericSplitAt = splitAt - - genericIndex :: (Integral i) => [a] -> i -> a - genericIndex = (!!) - - genericReplicate :: (Integral i) => i -> a -> [a] - genericReplicate = replicate |])