Commit 1408c8dc authored by Herbert Valerio Riedel's avatar Herbert Valerio Riedel 🕺

Remove redundant "Minimal complete definition"-comments

Those manual descriptions in Haddock strings have become redundant since
Haddock gained the ability to print the minimal complete definition as
specified via `{-# MINIMAL #-}` annotation (or otherwise inferred by
GHC).

Moreover, this commit moves all `{-# MINIMAL #-}` annotations in `base`
to the start of the respective `class` definitions, as this is more
readable and matches more closely the way Haddock renders that
information.
parent fe178b27
......@@ -58,7 +58,7 @@ infixr 1 ^<<, <<^
-- | The basic arrow class.
--
-- Minimal complete definition: 'arr' and 'first', satisfying the laws
-- Instances should satisfy the following laws:
--
-- * @'arr' id = 'id'@
--
......@@ -192,7 +192,7 @@ instance MonadPlus m => ArrowPlus (Kleisli m) where
-- | Choice, for arrows that support it. This class underlies the
-- @if@ and @case@ constructs in arrow notation.
--
-- Minimal complete definition: 'left', satisfying the laws
-- Instances should satisfy the following laws:
--
-- * @'left' ('arr' f) = 'arr' ('left' f)@
--
......
......@@ -34,6 +34,7 @@ import Control.Monad (liftM)
-- > munzip (mzip ma mb) = (ma, mb)
--
class Monad m => MonadZip m where
{-# MINIMAL mzip | mzipWith #-}
mzip :: m a -> m b -> m (a,b)
mzip = mzipWith (,)
......@@ -46,7 +47,6 @@ class Monad m => MonadZip m where
-- munzip is a member of the class because sometimes
-- you can implement it more efficiently than the
-- above default code. See Trac #4370 comment by giorgidze
{-# MINIMAL mzip | mzipWith #-}
instance MonadZip [] where
mzip = zip
......
......@@ -63,8 +63,6 @@ infix 4 `elem`, `notElem`
-- | Data structures that can be folded.
--
-- Minimal complete definition: 'foldMap' or 'foldr'.
--
-- For example, given a data type
--
-- > data Tree a = Empty | Leaf a | Node (Tree a) a (Tree a)
......
......@@ -61,8 +61,6 @@ import qualified GHC.List as List ( foldr )
-- | Functors representing data structures that can be traversed from
-- left to right.
--
-- Minimal complete definition: 'traverse' or 'sequenceA'.
--
-- A definition of 'traverse' must satisfy the following laws:
--
-- [/naturality/]
......@@ -144,6 +142,8 @@ import qualified GHC.List as List ( foldr )
-- ('foldMapDefault').
--
class (Functor t, Foldable t) => Traversable t where
{-# MINIMAL traverse | sequenceA #-}
-- | Map each element of a structure to an action, evaluate
-- these actions from left to right, and collect the results.
traverse :: Applicative f => (a -> f b) -> t a -> f (t b)
......@@ -163,7 +163,6 @@ class (Functor t, Foldable t) => Traversable t where
-- and collect the results.
sequence :: Monad m => t (m a) -> m (t a)
sequence = sequenceA
{-# MINIMAL traverse | sequenceA #-}
-- instances for Prelude types
......
......@@ -71,13 +71,12 @@ types of Haskell, the fixed size @Int@ types ('Int8', 'Int16',
'Int32', 'Int64'), the fixed size @Word@ types ('Word8', 'Word16',
'Word32', 'Word64'), 'StablePtr', all types from "Foreign.C.Types",
as well as 'Ptr'.
Minimal complete definition: 'sizeOf', 'alignment', one of 'peek',
'peekElemOff' and 'peekByteOff', and one of 'poke', 'pokeElemOff' and
'pokeByteOff'.
-}
class Storable a where
{-# MINIMAL sizeOf, alignment,
(peek | peekElemOff | peekByteOff),
(poke | pokeElemOff | pokeByteOff) #-}
sizeOf :: a -> Int
-- ^ Computes the storage requirements (in bytes) of the argument.
......@@ -147,10 +146,6 @@ class Storable a where
peek ptr = peekElemOff ptr 0
poke ptr = pokeElemOff ptr 0
{-# MINIMAL sizeOf, alignment,
(peek | peekElemOff | peekByteOff),
(poke | pokeElemOff | pokeByteOff) #-}
-- System-dependent, but rather obvious instances
instance Storable Bool where
......
......@@ -231,8 +231,6 @@ data Maybe a = Nothing | Just a
-- The method names refer to the monoid of lists under concatenation,
-- but there are many other instances.
--
-- Minimal complete definition: 'mempty' and 'mappend'.
--
-- Some types can be viewed as a monoid in more than one way,
-- e.g. both addition and multiplication on numbers.
-- In such cases we often define @newtype@s and make those instances
......@@ -429,8 +427,6 @@ think of a monad as an /abstract datatype/ of actions.
Haskell's @do@ expressions provide a convenient syntax for writing
monadic expressions.
Minimal complete definition: '>>=' and 'return'.
Instances of 'Monad' should satisfy the following laws:
> return a >>= k == k a
......@@ -617,8 +613,6 @@ infixl 3 <|>
-- | A monoid on applicative functors.
--
-- Minimal complete definition: 'empty' and '<|>'.
--
-- If defined, 'some' and 'many' should be the least solutions
-- of the equations:
--
......
......@@ -57,10 +57,6 @@ infixr 8 **
\begin{code}
-- | Trigonometric and hyperbolic functions and related functions.
--
-- Minimal complete definition:
-- 'pi', 'exp', 'log', 'sin', 'cos', 'sinh', 'cosh',
-- 'asin', 'acos', 'atan', 'asinh', 'acosh' and 'atanh'
class (Fractional a) => Floating a where
pi :: a
exp, log, sqrt :: a -> a
......@@ -83,9 +79,6 @@ class (Fractional a) => Floating a where
-- | Efficient, machine-independent access to the components of a
-- floating-point number.
--
-- Minimal complete definition:
-- all except 'exponent', 'significand', 'scaleFloat' and 'atan2'
class (RealFrac a, Floating a) => RealFloat a where
-- | a constant function, returning the radix of the representation
-- (often @2@)
......
......@@ -36,9 +36,9 @@ default () -- Double isn't available yet,
\begin{code}
-- | Basic numeric class.
--
-- Minimal complete definition: all except 'negate' or @(-)@
class Num a where
{-# MINIMAL (+), (*), abs, signum, fromInteger, (negate | (-)) #-}
(+), (-), (*) :: a -> a -> a
-- | Unary negation.
negate :: a -> a
......@@ -62,7 +62,6 @@ class Num a where
{-# INLINE negate #-}
x - y = x + negate y
negate x = 0 - x
{-# MINIMAL (+), (*), abs, signum, fromInteger, (negate | (-)) #-}
-- | the same as @'flip' ('-')@.
--
......
......@@ -100,8 +100,6 @@ readParen b g = if b then mandatory else optional
-- | Parsing of 'String's, producing values.
--
-- Minimal complete definition: 'readsPrec' (or, for GHC only, 'readPrec')
--
-- Derived instances of 'Read' make the following assumptions, which
-- derived instances of 'Text.Show.Show' obey:
--
......@@ -166,6 +164,8 @@ readParen b g = if b then mandatory else optional
-- > readListPrec = readListPrecDefault
class Read a where
{-# MINIMAL readsPrec | readPrec #-}
-- | attempts to parse a value from the front of the string, returning
-- a list of (parsed value, remaining string) pairs. If there is no
-- successful parse, the returned list is empty.
......@@ -204,7 +204,6 @@ class Read a where
readList = readPrec_to_S (list readPrec) 0
readPrec = readS_to_Prec readsPrec
readListPrec = readS_to_Prec (\_ -> readList)
{-# MINIMAL readsPrec | readPrec #-}
readListDefault :: Read a => ReadS [a]
-- ^ A possible replacement definition for the 'readList' method (GHC only).
......
......@@ -139,8 +139,6 @@ class (Num a, Ord a) => Real a where
toRational :: a -> Rational
-- | Integral numbers, supporting integer division.
--
-- Minimal complete definition: 'quotRem' and 'toInteger'
class (Real a, Enum a) => Integral a where
-- | integer division truncated toward zero
quot :: a -> a -> a
......@@ -174,9 +172,9 @@ class (Real a, Enum a) => Integral a where
where qr@(q,r) = quotRem n d
-- | Fractional numbers, supporting real division.
--
-- Minimal complete definition: 'fromRational' and ('recip' or @('/')@)
class (Num a) => Fractional a where
{-# MINIMAL fromRational, (recip | (/)) #-}
-- | fractional division
(/) :: a -> a -> a
-- | reciprocal fraction
......@@ -191,11 +189,8 @@ class (Num a) => Fractional a where
{-# INLINE (/) #-}
recip x = 1 / x
x / y = x * recip y
{-# MINIMAL fromRational, (recip | (/)) #-}
-- | Extracting components of fractions.
--
-- Minimal complete definition: 'properFraction'
class (Real a, Fractional a) => RealFrac a where
-- | The function 'properFraction' takes a real fractional number @x@
-- and returns a pair @(n,f)@ such that @x = n+f@, and:
......
......@@ -71,8 +71,6 @@ type ShowS = String -> String
-- | Conversion of values to readable 'String's.
--
-- Minimal complete definition: 'showsPrec' or 'show'.
--
-- Derived instances of 'Show' have the following properties, which
-- are compatible with derived instances of 'Text.Read.Read':
--
......@@ -121,6 +119,8 @@ type ShowS = String -> String
-- @\"Leaf 1 :^: (Leaf 2 :^: Leaf 3)\"@.
class Show a where
{-# MINIMAL showsPrec | show #-}
-- | Convert a value to a readable 'String'.
--
-- 'showsPrec' should satisfy the law
......@@ -155,7 +155,6 @@ class Show a where
showsPrec _ x s = show x ++ s
show x = shows x ""
showList ls s = showList__ shows ls s
{-# MINIMAL showsPrec | show #-}
showList__ :: (a -> ShowS) -> [a] -> ShowS
showList__ _ [] s = "[]" ++ s
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment