Commit ddffa0cd authored by Alec Theriault's avatar Alec Theriault Committed by Ben Gamari

Fix ambiguous/out-of-scope Haddock identifiers

This drastically cuts down on the number of Haddock warnings when making
docs for `base`.  Plus this means more actual links end up in the docs!
Also fixed other small mostly markup issues in the documentation along
the way.

This is a docs-only change.

Reviewers: hvr, bgamari, thomie

Reviewed By: thomie

Subscribers: thomie, rwbarton, carter

Differential Revision: https://phabricator.haskell.org/D5055
parent 14817621
...@@ -76,7 +76,7 @@ infixr 1 ^<<, <<^ ...@@ -76,7 +76,7 @@ infixr 1 ^<<, <<^
-- --
-- * @'first' f >>> 'arr' ('id' *** g) = 'arr' ('id' *** g) >>> 'first' f@ -- * @'first' f >>> 'arr' ('id' *** g) = 'arr' ('id' *** g) >>> 'first' f@
-- --
-- * @'first' ('first' f) >>> 'arr' 'assoc' = 'arr' 'assoc' >>> 'first' f@ -- * @'first' ('first' f) >>> 'arr' assoc = 'arr' assoc >>> 'first' f@
-- --
-- where -- where
-- --
...@@ -209,7 +209,7 @@ instance MonadPlus m => ArrowPlus (Kleisli m) where ...@@ -209,7 +209,7 @@ instance MonadPlus m => ArrowPlus (Kleisli m) where
-- --
-- * @'left' f >>> 'arr' ('id' +++ g) = 'arr' ('id' +++ g) >>> 'left' f@ -- * @'left' f >>> 'arr' ('id' +++ g) = 'arr' ('id' +++ g) >>> 'left' f@
-- --
-- * @'left' ('left' f) >>> 'arr' 'assocsum' = 'arr' 'assocsum' >>> 'left' f@ -- * @'left' ('left' f) >>> 'arr' assocsum = 'arr' assocsum >>> 'left' f@
-- --
-- where -- where
-- --
......
...@@ -102,8 +102,8 @@ writeChan (Chan _ writeVar) val = do ...@@ -102,8 +102,8 @@ writeChan (Chan _ writeVar) val = do
-- guarantees of 'MVar's (e.g. threads blocked in this operation are woken up in -- guarantees of 'MVar's (e.g. threads blocked in this operation are woken up in
-- FIFO order). -- FIFO order).
-- --
-- Throws 'BlockedIndefinitelyOnMVar' when the channel is empty and no other -- Throws 'Control.Exception.BlockedIndefinitelyOnMVar' when the channel is
-- thread holds a reference to the channel. -- empty and no other thread holds a reference to the channel.
readChan :: Chan a -> IO a readChan :: Chan a -> IO a
readChan (Chan readVar _) = do readChan (Chan readVar _) = do
modifyMVar readVar $ \read_end -> do modifyMVar readVar $ \read_end -> do
......
...@@ -33,12 +33,12 @@ ...@@ -33,12 +33,12 @@
-- --
-- === Applicability -- === Applicability
-- --
-- 'MVar's offer more flexibility than 'IORef's, but less flexibility -- 'MVar's offer more flexibility than 'Data.IORef.IORef's, but less flexibility
-- than 'STM'. They are appropriate for building synchronization -- than 'GHC.Conc.STM'. They are appropriate for building synchronization
-- primitives and performing simple interthread communication; however -- primitives and performing simple interthread communication; however
-- they are very simple and susceptible to race conditions, deadlocks or -- they are very simple and susceptible to race conditions, deadlocks or
-- uncaught exceptions. Do not use them if you need perform larger -- uncaught exceptions. Do not use them if you need perform larger
-- atomic operations such as reading from multiple variables: use 'GHC.Conc.STM'
-- instead. -- instead.
-- --
-- In particular, the "bigger" functions in this module ('swapMVar', -- In particular, the "bigger" functions in this module ('swapMVar',
...@@ -70,7 +70,7 @@ ...@@ -70,7 +70,7 @@
-- --
-- 'MVar' operations are always observed to take place in the order -- 'MVar' operations are always observed to take place in the order
-- they are written in the program, regardless of the memory model of -- they are written in the program, regardless of the memory model of
-- the underlying machine. This is in contrast to 'IORef' operations -- the underlying machine. This is in contrast to 'Data.IORef.IORef' operations
-- which may appear out-of-order to another thread in some cases. -- which may appear out-of-order to another thread in some cases.
-- --
-- === Example -- === Example
......
...@@ -264,7 +264,7 @@ to write something like ...@@ -264,7 +264,7 @@ to write something like
> (\e -> handler) > (\e -> handler)
If you need to unmask asynchronous exceptions again in the exception If you need to unmask asynchronous exceptions again in the exception
handler, 'restore' can be used there too. handler, @restore@ can be used there too.
Note that 'try' and friends /do not/ have a similar default, because Note that 'try' and friends /do not/ have a similar default, because
there is no exception handler in this case. Don't use 'try' for there is no exception handler in this case. Don't use 'try' for
...@@ -332,21 +332,24 @@ kind of situation: ...@@ -332,21 +332,24 @@ kind of situation:
The following operations are guaranteed not to be interruptible: The following operations are guaranteed not to be interruptible:
* operations on 'IORef' from "Data.IORef" * operations on 'Data.IORef.IORef' from "Data.IORef"
* STM transactions that do not use 'retry' * STM transactions that do not use 'GHC.Conc.retry'
* everything from the @Foreign@ modules * everything from the @Foreign@ modules
* everything from @Control.Exception@ except for 'throwTo' * everything from "Control.Exception" except for 'throwTo'
* @tryTakeMVar@, @tryPutMVar@, @isEmptyMVar@ * 'Control.Concurrent.MVar.tryTakeMVar', 'Control.Concurrent.MVar.tryPutMVar',
'Control.Concurrent.MVar.isEmptyMVar'
* @takeMVar@ if the @MVar@ is definitely full, and conversely @putMVar@ if the @MVar@ is definitely empty * 'Control.Concurrent.MVar.takeMVar' if the 'Control.Concurrent.MVar.MVar' is
definitely full, and conversely 'Control.Concurrent.MVar.putMVar' if the
'Control.Concurrent.MVar.MVar' is definitely empty
* @newEmptyMVar@, @newMVar@ * 'Control.Concurrent.MVar.newEmptyMVar', 'Control.Concurrent.MVar.newMVar'
* @forkIO@, @forkIOUnmasked@, @myThreadId@ * 'Control.Concurrent.forkIO', 'Control.Concurrent.myThreadId'
-} -}
......
...@@ -131,7 +131,7 @@ guard :: (Alternative f) => Bool -> f () ...@@ -131,7 +131,7 @@ guard :: (Alternative f) => Bool -> f ()
guard True = pure () guard True = pure ()
guard False = empty guard False = empty
-- | This generalizes the list-based 'filter' function. -- | This generalizes the list-based 'Data.List.filter' function.
{-# INLINE filterM #-} {-# INLINE filterM #-}
filterM :: (Applicative m) => (a -> m Bool) -> [a] -> m [a] filterM :: (Applicative m) => (a -> m Bool) -> [a] -> m [a]
...@@ -203,7 +203,7 @@ zipWithM_ :: (Applicative m) => (a -> b -> m c) -> [a] -> [b] -> m () ...@@ -203,7 +203,7 @@ zipWithM_ :: (Applicative m) => (a -> b -> m c) -> [a] -> [b] -> m ()
{-# INLINE zipWithM_ #-} {-# INLINE zipWithM_ #-}
zipWithM_ f xs ys = sequenceA_ (zipWith f xs ys) zipWithM_ f xs ys = sequenceA_ (zipWith f xs ys)
{- | The 'foldM' function is analogous to 'foldl', except that its result is {- | The 'foldM' function is analogous to 'Data.Foldable.foldl', except that its result is
encapsulated in a monad. Note that 'foldM' works from left-to-right over encapsulated in a monad. Note that 'foldM' works from left-to-right over
the list arguments. This could be an issue where @('>>')@ and the `folded the list arguments. This could be an issue where @('>>')@ and the `folded
function' are not commutative. function' are not commutative.
......
...@@ -50,13 +50,13 @@ import {-# SOURCE #-} GHC.IO (failIO) ...@@ -50,13 +50,13 @@ import {-# SOURCE #-} GHC.IO (failIO)
-- only a single data constructor, and irrefutable patterns (@~pat@). -- only a single data constructor, and irrefutable patterns (@~pat@).
-- --
-- Instances of 'MonadFail' should satisfy the following law: @fail s@ should -- Instances of 'MonadFail' should satisfy the following law: @fail s@ should
-- be a left zero for '>>=', -- be a left zero for 'Control.Monad.>>=',
-- --
-- @ -- @
-- fail s >>= f = fail s -- fail s >>= f = fail s
-- @ -- @
-- --
-- If your 'Monad' is also 'MonadPlus', a popular definition is -- If your 'Monad' is also 'Control.Monad.MonadPlus', a popular definition is
-- --
-- @ -- @
-- fail _ = mzero -- fail _ = mzero
......
...@@ -40,7 +40,7 @@ import System.IO ...@@ -40,7 +40,7 @@ import System.IO
-- Instances of 'MonadFix' should satisfy the following laws: -- Instances of 'MonadFix' should satisfy the following laws:
-- --
-- [/purity/] -- [/purity/]
-- @'mfix' ('return' . h) = 'return' ('fix' h)@ -- @'mfix' ('Control.Monad.return' . h) = 'Control.Monad.return' ('fix' h)@
-- --
-- [/left shrinking/ (or /tightening/)] -- [/left shrinking/ (or /tightening/)]
-- @'mfix' (\\x -> a >>= \\y -> f x y) = a >>= \\y -> 'mfix' (\\x -> f x y)@ -- @'mfix' (\\x -> a >>= \\y -> f x y) = a >>= \\y -> 'mfix' (\\x -> f x y)@
......
...@@ -24,7 +24,7 @@ module Control.Monad.ST.Imp ( ...@@ -24,7 +24,7 @@ module Control.Monad.ST.Imp (
runST, runST,
fixST, fixST,
-- * Converting 'ST' to 'IO' -- * Converting 'ST' to 'Prelude.IO'
RealWorld, -- abstract RealWorld, -- abstract
stToIO, stToIO,
......
...@@ -76,7 +76,7 @@ import GHC.Generics (K1(..)) ...@@ -76,7 +76,7 @@ import GHC.Generics (K1(..))
-- 'bifoldr' f g z t ≡ 'appEndo' ('bifoldMap' (Endo . f) (Endo . g) t) z -- 'bifoldr' f g z t ≡ 'appEndo' ('bifoldMap' (Endo . f) (Endo . g) t) z
-- @ -- @
-- --
-- If the type is also a 'Bifunctor' instance, it should satisfy: -- If the type is also a 'Data.Bifunctor.Bifunctor' instance, it should satisfy:
-- --
-- > 'bifoldMap' f g ≡ 'bifold' . 'bimap' f g -- > 'bifoldMap' f g ≡ 'bifold' . 'bimap' f g
-- --
......
...@@ -52,8 +52,11 @@ import GHC.Generics (K1(..)) ...@@ -52,8 +52,11 @@ import GHC.Generics (K1(..))
-- @'bitraverse' 'Identity' 'Identity' ≡ 'Identity'@ -- @'bitraverse' 'Identity' 'Identity' ≡ 'Identity'@
-- --
-- [/composition/] -- [/composition/]
-- @'Compose' . 'fmap' ('bitraverse' g1 g2) . 'bitraverse' f1 f2 -- @'Data.Functor.Compose.Compose' .
-- ≡ 'traverse' ('Compose' . 'fmap' g1 . f1) ('Compose' . 'fmap' g2 . f2)@ -- 'fmap' ('bitraverse' g1 g2) .
-- 'bitraverse' f1 f2
-- ≡ 'traverse' ('Data.Functor.Compose.Compose' . 'fmap' g1 . f1)
-- ('Data.Functor.Compose.Compose' . 'fmap' g2 . f2)@
-- --
-- where an /applicative transformation/ is a function -- where an /applicative transformation/ is a function
-- --
...@@ -66,26 +69,9 @@ import GHC.Generics (K1(..)) ...@@ -66,26 +69,9 @@ import GHC.Generics (K1(..))
-- t (f '<*>' x) = t f '<*>' t x -- t (f '<*>' x) = t f '<*>' t x
-- @ -- @
-- --
-- and the identity functor 'Identity' and composition functors 'Compose' are -- and the identity functor 'Identity' and composition functors
-- defined as -- 'Data.Functor.Compose.Compose' are from "Data.Functor.Identity" and
-- -- "Data.Functor.Compose".
-- > newtype Identity a = Identity { runIdentity :: a }
-- >
-- > instance Functor Identity where
-- > fmap f (Identity x) = Identity (f x)
-- >
-- > instance Applicative Identity where
-- > pure = Identity
-- > Identity f <*> Identity x = Identity (f x)
-- >
-- > newtype Compose f g a = Compose (f (g a))
-- >
-- > instance (Functor f, Functor g) => Functor (Compose f g) where
-- > fmap f (Compose x) = Compose (fmap (fmap f) x)
-- >
-- > instance (Applicative f, Applicative g) => Applicative (Compose f g) where
-- > pure = Compose . pure . pure
-- --
-- Some simple examples are 'Either' and '(,)': -- Some simple examples are 'Either' and '(,)':
-- --
......
...@@ -164,7 +164,7 @@ instance Monad (Either e) where ...@@ -164,7 +164,7 @@ instance Monad (Either e) where
-- --
-- We create two values of type @'Either' 'String' 'Int'@, one using the -- We create two values of type @'Either' 'String' 'Int'@, one using the
-- 'Left' constructor and another using the 'Right' constructor. Then -- 'Left' constructor and another using the 'Right' constructor. Then
-- we apply \"either\" the 'length' function (if we have a 'String') -- we apply \"either\" the 'Prelude.length' function (if we have a 'String')
-- or the \"times-two\" function (if we have an 'Int'): -- or the \"times-two\" function (if we have an 'Int'):
-- --
-- >>> let s = Left "foo" :: Either String Int -- >>> let s = Left "foo" :: Either String Int
......
...@@ -172,8 +172,8 @@ class Foldable t where ...@@ -172,8 +172,8 @@ class Foldable t where
-- --
-- Also note that if you want an efficient left-fold, you probably want to -- Also note that if you want an efficient left-fold, you probably want to
-- use 'foldl'' instead of 'foldl'. The reason for this is that latter does -- use 'foldl'' instead of 'foldl'. The reason for this is that latter does
-- not force the "inner" results (e.g. @z `f` x1@ in the above example) -- not force the "inner" results (e.g. @z \`f\` x1@ in the above example)
-- before applying them to the operator (e.g. to @(`f` x2)@). This results -- before applying them to the operator (e.g. to @(\`f\` x2)@). This results
-- in a thunk chain @O(n)@ elements long, which then must be evaluated from -- in a thunk chain @O(n)@ elements long, which then must be evaluated from
-- the outside-in. -- the outside-in.
-- --
......
...@@ -45,16 +45,18 @@ infixl 1 & ...@@ -45,16 +45,18 @@ infixl 1 &
-- 120 -- 120
-- --
-- Instead of making a recursive call, we introduce a dummy parameter @rec@; -- Instead of making a recursive call, we introduce a dummy parameter @rec@;
-- when used within 'fix', this parameter then refers to 'fix'' argument, hence -- when used within 'fix', this parameter then refers to 'fix' argument, hence
-- the recursion is reintroduced. -- the recursion is reintroduced.
fix :: (a -> a) -> a fix :: (a -> a) -> a
fix f = let x = f x in x fix f = let x = f x in x
-- | @'on' b u x y@ runs the binary function `b` /on/ the results of applying unary function `u` to two arguments `x` and `y`. From the opposite perspective, it transforms two inputs and combines the outputs. -- | @'on' b u x y@ runs the binary function @b@ /on/ the results of applying
-- unary function @u@ to two arguments @x@ and @y@. From the opposite
-- perspective, it transforms two inputs and combines the outputs.
-- --
-- @((+) \``on`\` f) x y = f x + f y@ -- @((+) \``on`\` f) x y = f x + f y@
-- --
-- Typical usage: @'Data.List.sortBy' ('compare' \`on\` 'fst')@. -- Typical usage: @'Data.List.sortBy' ('Prelude.compare' \`on\` 'Prelude.fst')@.
-- --
-- Algebraic properties: -- Algebraic properties:
-- --
......
...@@ -57,26 +57,27 @@ infixl 4 <$> ...@@ -57,26 +57,27 @@ infixl 4 <$>
-- | An infix synonym for 'fmap'. -- | An infix synonym for 'fmap'.
-- --
-- The name of this operator is an allusion to '$'. -- The name of this operator is an allusion to 'Prelude.$'.
-- Note the similarities between their types: -- Note the similarities between their types:
-- --
-- > ($) :: (a -> b) -> a -> b -- > ($) :: (a -> b) -> a -> b
-- > (<$>) :: Functor f => (a -> b) -> f a -> f b -- > (<$>) :: Functor f => (a -> b) -> f a -> f b
-- --
-- Whereas '$' is function application, '<$>' is function -- Whereas 'Prelude.$' is function application, '<$>' is function
-- application lifted over a 'Functor'. -- application lifted over a 'Functor'.
-- --
-- ==== __Examples__ -- ==== __Examples__
-- --
-- Convert from a @'Maybe' 'Int'@ to a @'Maybe' 'String'@ using 'show': -- Convert from a @'Data.Maybe.Maybe' 'Data.Int.Int'@ to a @'Data.Maybe.Maybe'
-- 'Data.String.String'@ using 'Prelude.show':
-- --
-- >>> show <$> Nothing -- >>> show <$> Nothing
-- Nothing -- Nothing
-- >>> show <$> Just 3 -- >>> show <$> Just 3
-- Just "3" -- Just "3"
-- --
-- Convert from an @'Either' 'Int' 'Int'@ to an @'Either' 'Int'@ -- Convert from an @'Data.Either.Either' 'Data.Int.Int' 'Data.Int.Int'@ to an
-- 'String' using 'show': -- @'Data.Either.Either' 'Data.Int.Int'@ 'Data.String.String' using 'Prelude.show':
-- --
-- >>> show <$> Left 17 -- >>> show <$> Left 17
-- Left 17 -- Left 17
...@@ -88,7 +89,7 @@ infixl 4 <$> ...@@ -88,7 +89,7 @@ infixl 4 <$>
-- >>> (*2) <$> [1,2,3] -- >>> (*2) <$> [1,2,3]
-- [2,4,6] -- [2,4,6]
-- --
-- Apply 'even' to the second element of a pair: -- Apply 'Prelude.even' to the second element of a pair:
-- --
-- >>> even <$> (2,2) -- >>> even <$> (2,2)
-- (2,True) -- (2,True)
...@@ -129,27 +130,29 @@ infixl 1 <&> ...@@ -129,27 +130,29 @@ infixl 1 <&>
-- --
-- ==== __Examples__ -- ==== __Examples__
-- --
-- Replace the contents of a @'Maybe' 'Int'@ with a constant 'String': -- Replace the contents of a @'Data.Maybe.Maybe' 'Data.Int.Int'@ with a constant
-- 'Data.String.String':
-- --
-- >>> Nothing $> "foo" -- >>> Nothing $> "foo"
-- Nothing -- Nothing
-- >>> Just 90210 $> "foo" -- >>> Just 90210 $> "foo"
-- Just "foo" -- Just "foo"
-- --
-- Replace the contents of an @'Either' 'Int' 'Int'@ with a constant -- Replace the contents of an @'Data.Either.Either' 'Data.Int.Int' 'Data.Int.Int'@
-- 'String', resulting in an @'Either' 'Int' 'String'@: -- with a constant 'Data.String.String', resulting in an @'Data.Either.Either'
-- 'Data.Int.Int' 'Data.String.String'@:
-- --
-- >>> Left 8675309 $> "foo" -- >>> Left 8675309 $> "foo"
-- Left 8675309 -- Left 8675309
-- >>> Right 8675309 $> "foo" -- >>> Right 8675309 $> "foo"
-- Right "foo" -- Right "foo"
-- --
-- Replace each element of a list with a constant 'String': -- Replace each element of a list with a constant 'Data.String.String':
-- --
-- >>> [1,2,3] $> "foo" -- >>> [1,2,3] $> "foo"
-- ["foo","foo","foo"] -- ["foo","foo","foo"]
-- --
-- Replace the second element of a pair with a constant 'String': -- Replace the second element of a pair with a constant 'Data.String.String':
-- --
-- >>> (1,2) $> "foo" -- >>> (1,2) $> "foo"
-- (1,"foo") -- (1,"foo")
...@@ -162,15 +165,15 @@ infixl 1 <&> ...@@ -162,15 +165,15 @@ infixl 1 <&>
-- --
-- ==== __Examples__ -- ==== __Examples__
-- --
-- Replace the contents of a @'Maybe' 'Int'@ with unit: -- Replace the contents of a @'Data.Maybe.Maybe' 'Data.Int.Int'@ with unit:
-- --
-- >>> void Nothing -- >>> void Nothing
-- Nothing -- Nothing
-- >>> void (Just 3) -- >>> void (Just 3)
-- Just () -- Just ()
-- --
-- Replace the contents of an @'Either' 'Int' 'Int'@ with unit, -- Replace the contents of an @'Data.Either.Either' 'Data.Int.Int' 'Data.Int.Int'@
-- resulting in an @'Either' 'Int' '()'@: -- with unit, resulting in an @'Data.Either.Either' 'Data.Int.Int' '()'@:
-- --
-- >>> void (Left 8675309) -- >>> void (Left 8675309)
-- Left 8675309 -- Left 8675309
......
...@@ -59,7 +59,7 @@ newtype Const a b = Const { getConst :: a } ...@@ -59,7 +59,7 @@ newtype Const a b = Const { getConst :: a }
) )
-- | This instance would be equivalent to the derived instances of the -- | This instance would be equivalent to the derived instances of the
-- 'Const' newtype if the 'runConst' field were removed -- 'Const' newtype if the 'getConst' field were removed
-- --
-- @since 4.8.0.0 -- @since 4.8.0.0
instance Read a => Read (Const a b) where instance Read a => Read (Const a b) where
...@@ -67,7 +67,7 @@ instance Read a => Read (Const a b) where ...@@ -67,7 +67,7 @@ instance Read a => Read (Const a b) where
$ \r -> [(Const x,t) | ("Const", s) <- lex r, (x, t) <- readsPrec 11 s] $ \r -> [(Const x,t) | ("Const", s) <- lex r, (x, t) <- readsPrec 11 s]
-- | This instance would be equivalent to the derived instances of the -- | This instance would be equivalent to the derived instances of the
-- 'Const' newtype if the 'runConst' field were removed -- 'Const' newtype if the 'getConst' field were removed
-- --
-- @since 4.8.0.0 -- @since 4.8.0.0
instance Show a => Show (Const a b) where instance Show a => Show (Const a b) where
......
...@@ -103,7 +103,7 @@ class Contravariant f where ...@@ -103,7 +103,7 @@ class Contravariant f where
(>$) :: b -> f b -> f a (>$) :: b -> f b -> f a
(>$) = contramap . const (>$) = contramap . const
-- | If 'f' is both 'Functor' and 'Contravariant' then by the time you factor -- | If @f@ is both 'Functor' and 'Contravariant' then by the time you factor
-- in the laws of each of those classes, it can't actually use its argument in -- in the laws of each of those classes, it can't actually use its argument in
-- any meaningful capacity. -- any meaningful capacity.
-- --
......
...@@ -178,8 +178,8 @@ module Data.List ...@@ -178,8 +178,8 @@ module Data.List
-- counterpart whose name is suffixed with \`@By@\'. -- counterpart whose name is suffixed with \`@By@\'.
-- --
-- It is often convenient to use these functions together with -- It is often convenient to use these functions together with
-- 'Data.Function.on', for instance @'sortBy' ('compare' -- 'Data.Function.on', for instance @'sortBy' ('Prelude.compare'
-- \`on\` 'fst')@. -- ``Data.Function.on`` 'Prelude.fst')@.
-- *** User-supplied equality (replacing an @Eq@ context) -- *** User-supplied equality (replacing an @Eq@ context)
-- | The predicate is assumed to define an equivalence. -- | The predicate is assumed to define an equivalence.
......
...@@ -380,7 +380,7 @@ groupWith1 f = groupBy1 ((==) `on` f) ...@@ -380,7 +380,7 @@ groupWith1 f = groupBy1 ((==) `on` f)
groupAllWith1 :: (Ord b) => (a -> b) -> NonEmpty a -> NonEmpty (NonEmpty a) groupAllWith1 :: (Ord b) => (a -> b) -> NonEmpty a -> NonEmpty (NonEmpty a)
groupAllWith1 f = groupWith1 f . sortWith f groupAllWith1 f = groupWith1 f . sortWith f
-- | The 'isPrefix' function returns @True@ if the first argument is -- | The 'isPrefixOf' function returns 'True' if the first argument is
-- a prefix of the second. -- a prefix of the second.
isPrefixOf :: Eq a => [a] -> NonEmpty a -> Bool isPrefixOf :: Eq a => [a] -> NonEmpty a -> Bool
isPrefixOf [] _ = True isPrefixOf [] _ = True
......
...@@ -55,7 +55,7 @@ import GHC.Base ...@@ -55,7 +55,7 @@ import GHC.Base
-- >>> maybe False odd Nothing -- >>> maybe False odd Nothing
-- False -- False
-- --
-- Read an integer from a string using 'readMaybe'. If we succeed, -- Read an integer from a string using 'Text.Read.readMaybe'. If we succeed,
-- return twice the integer; that is, apply @(*2)@ to it. If instead -- return twice the integer; that is, apply @(*2)@ to it. If instead
-- we fail to parse an integer, return @0@ by default: -- we fail to parse an integer, return @0@ by default:
-- --
...@@ -65,7 +65,7 @@ import GHC.Base ...@@ -65,7 +65,7 @@ import GHC.Base
-- >>> maybe 0 (*2) (readMaybe "") -- >>> maybe 0 (*2) (readMaybe "")
-- 0 -- 0
-- --
-- Apply 'show' to a @Maybe Int@. If we have @Just n@, we want to show -- Apply 'Prelude.show' to a @Maybe Int@. If we have @Just n@, we want to show
-- the underlying 'Int' @n@. But if we have 'Nothing', we return the -- the underlying 'Int' @n@. But if we have 'Nothing', we return the
-- empty string instead of (for example) \"Nothing\": -- empty string instead of (for example) \"Nothing\":
-- --
...@@ -161,7 +161,7 @@ fromJust (Just x) = x ...@@ -161,7 +161,7 @@ fromJust (Just x) = x
-- >>> fromMaybe "" Nothing -- >>> fromMaybe "" Nothing
-- "" -- ""
-- --
-- Read an integer from a string using 'readMaybe'. If we fail to -- Read an integer from a string using 'Text.Read.readMaybe'. If we fail to
-- parse an integer, we want to return @0@ by default: -- parse an integer, we want to return @0@ by default:
-- --
-- >>> import Text.Read ( readMaybe ) -- >>> import Text.Read ( readMaybe )
......
...@@ -91,7 +91,7 @@ import Control.Monad.Fail (MonadFail) ...@@ -91,7 +91,7 @@ import Control.Monad.Fail (MonadFail)