The Web framework for perfectionists with deadlines.

Translation of http://e-maxx.ru into English

Empowering everyone to build reliable and efficient software.

Learn Rust by writing Entirely Too Many linked lists

issue openedhaskell/containers

Inconsistent usage of `==` and `=` equality in docs

While reading the docs for Data.Set, I noticed that in some places `==`

is used and in some `=`

is used. For example, the docs for `powerSet`

:

Calculate the power set of a set: the set of all its subsets.

`t `member` powerSet s == t `isSubsetOf` s`

Example:

`powerSet (fromList [1,2,3]) = fromList $ map fromList [[],[1],[1,2],[1,2,3],[1,3],[2],[2,3],[3]]`

I guess that `=`

should be used only if we can prove it from the definitions, and only if both sides are "internally" equal. For instance, we can disprove the above example easily:

```
Prelude Data.Set> putTree = putStrLn . showTree
Prelude Data.Set> putTree $ powerSet (fromList [1,2,3])
fromList [1,3]
+--fromList [1,2]
| +--fromList [1]
| | +--fromList []
| | +--|
| +--fromList [1,2,3]
+--fromList [2,3]
+--fromList [2]
+--fromList [3]
Prelude Data.Set> putTree $ fromList $ Prelude.map fromList [[],[1],[1,2],[1,2,3],[1,3],[2],[2,3],[3]]
fromList [1,2,3]
+--fromList [1]
| +--fromList []
| +--fromList [1,2]
+--fromList [2]
+--fromList [1,3]
+--fromList [2,3]
+--|
+--fromList [3]
```

The examples for `cartesianProduct`

and `disjointUnion`

can be disproved similarly. From looking around, other modules like IntSet and Map modules also have this issue.

I suppose every nontrivial example/law equation with containers on both sides should use `==`

instead of `=`

.

created time in 2 months