Skip to content

Commit

Permalink
Minor docs fixes (#452)
Browse files Browse the repository at this point in the history
* Remove misplaced comment

  Seems like a copy-and-paste error

* s/substitutivity/extensionality

  The Eq docs were reworded to use "extensionality" a while ago.
  • Loading branch information
sjakobi authored May 3, 2022
1 parent 9078dd5 commit 8bb958e
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 7 deletions.
7 changes: 2 additions & 5 deletions Data/HashMap/Internal.hs
Original file line number Diff line number Diff line change
Expand Up @@ -177,9 +177,6 @@ import qualified Data.List as List
import qualified GHC.Exts as Exts
import qualified Language.Haskell.TH.Syntax as TH

-- | A set of values. A set cannot contain duplicate values.
------------------------------------------------------------------------

-- | Convenience function. Compute a hash value for the given value.
hash :: H.Hashable a => a -> Hash
hash = fromIntegral . H.hash
Expand Down Expand Up @@ -400,7 +397,7 @@ instance Eq k => Eq1 (HashMap k) where
liftEq = equal1

-- | Note that, in the presence of hash collisions, equal @HashMap@s may
-- behave differently, i.e. substitutivity may be violated:
-- behave differently, i.e. extensionality may be violated:
--
-- >>> data D = A | B deriving (Eq, Show)
-- >>> instance Hashable D where hashWithSalt salt _d = salt
Expand All @@ -415,7 +412,7 @@ instance Eq k => Eq1 (HashMap k) where
-- >>> toList y
-- [(B,2),(A,1)]
--
-- In general, the lack of substitutivity can be observed with any function
-- In general, the lack of extensionality can be observed with any function
-- that depends on the key ordering, such as folds and traversals.
instance (Eq k, Eq v) => Eq (HashMap k v) where
(==) = equal1 (==)
Expand Down
4 changes: 2 additions & 2 deletions Data/HashSet/Internal.hs
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ instance NFData1 HashSet where
liftRnf rnf1 = liftRnf2 rnf1 rnf . asMap

-- | Note that, in the presence of hash collisions, equal @HashSet@s may
-- behave differently, i.e. substitutivity may be violated:
-- behave differently, i.e. extensionality may be violated:
--
-- >>> data D = A | B deriving (Eq, Show)
-- >>> instance Hashable D where hashWithSalt salt _d = salt
Expand All @@ -142,7 +142,7 @@ instance NFData1 HashSet where
-- >>> toList y
-- [B,A]
--
-- In general, the lack of substitutivity can be observed with any function
-- In general, the lack of extensionality can be observed with any function
-- that depends on the key ordering, such as folds and traversals.
instance (Eq a) => Eq (HashSet a) where
HashSet a == HashSet b = equalKeys a b
Expand Down

0 comments on commit 8bb958e

Please sign in to comment.