@@ -8,7 +8,7 @@ introductory documentation for @containers@ at
8
8
<https://haskell-containers.readthedocs.io>.
9
9
10
10
@
11
- data HashSet element = ...
11
+ data ' HashSet' element = ...
12
12
@
13
13
14
14
@@ -17,8 +17,8 @@ functions do not modify the set that you passed in, they creates a new set. In
17
17
order to keep the changes you need to assign it to a new variable. For example:
18
18
19
19
@
20
- let s1 = HashSet.fromList ["a", "b"]
21
- let s2 = HashSet.delete "a" s1
20
+ let s1 = ' HashSet.fromList' ["a", "b"]
21
+ let s2 = ' HashSet.delete' "a" s1
22
22
print s1
23
23
> fromList ["a","b"]
24
24
print s2
@@ -41,42 +41,43 @@ module Tutorial.HashSet (
41
41
42
42
) where
43
43
44
+ import qualified Data.HashSet as HashSet
44
45
45
46
{- $shortexample
46
47
47
48
The following GHCi session shows some of the basic set functionality:
48
49
49
50
@
50
- import qualified Data.HashSet as HashSet
51
+ import qualified ' Data.HashSet' as HashSet
51
52
52
- let dataStructures = HashSet.fromList ["HashSet", "HashMap", "Graph"]
53
+ let dataStructures = ' HashSet.fromList' ["HashSet", "HashMap", "Graph"]
53
54
54
55
-- Check if "HashMap" and "Trie" are in the set of data structures.
55
- HashSet.member "HashMap" dataStructures
56
+ ' HashSet.member' "HashMap" dataStructures
56
57
> True
57
58
58
- HashSet.member "Trie" dataStructures
59
+ ' HashSet.member' "Trie" dataStructures
59
60
> False
60
61
61
62
62
63
-- Add "Trie" to our original set of data structures.
63
64
let moreDataStructures = HashSet.insert "Trie" dataStructures
64
65
65
- HashSet.member "Trie" moreDataStructures
66
+ ' HashSet.member' "Trie" moreDataStructures
66
67
> True
67
68
68
69
69
70
-- Remove "Graph" from our original set of data structures.
70
71
let fewerDataStructures = HashSet.delete "Graph" dataStructures
71
72
72
- HashSet.toList fewerDataStructures
73
+ ' HashSet.toList' fewerDataStructures
73
74
> ["HashSet", "HashMap"]
74
75
75
76
76
77
-- Create a new set and combine it with our original set.
77
78
let orderedDataStructures = HashSet.fromList ["Set", "Map"]
78
79
79
- HashSet.union dataStructures orderedDataStructures
80
+ ' HashSet.union' dataStructures orderedDataStructures
80
81
> fromList ["Map", "HashSet", "Graph", "HashMap", "Set"]
81
82
@
82
83
0 commit comments