Skip to content

Commit 0316afb

Browse files
committed
cleanup, add instance doc
1 parent 2f3726a commit 0316afb

File tree

4 files changed

+24
-16
lines changed

4 files changed

+24
-16
lines changed

README.md

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -43,28 +43,31 @@ Constructs a character from the given Unicode numeric value.
4343
instance eqChar :: Eq Char
4444
```
4545

46+
Characters can be compared for equality with `==` and `/=`.
4647

4748
#### `ordChar`
4849

4950
``` purescript
5051
instance ordChar :: Ord Char
5152
```
5253

54+
Characters can be compared with `compare`, `>`, `>=`, `<` and `<=`.
5355

5456
#### `showChar`
5557

5658
``` purescript
5759
instance showChar :: Show Char
5860
```
5961

62+
Characters can be rendered as a string with `show`.
6063

6164

6265
## Module Data.String
6366

6467

6568
Wraps the functions of Javascript's `String` object.
6669
A String represents a sequence of characters.
67-
For examples and details of the underlying implementation, see [String Reference at MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String).
70+
For details of the underlying implementation, see [String Reference at MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String).
6871

6972
#### `charAt`
7073

@@ -123,8 +126,8 @@ if the string is not empty.
123126
takeWhile :: (Char -> Boolean) -> String -> String
124127
```
125128

126-
Returns the longest prefix (possibly empty) of characters that satisfy the
127-
predicate:
129+
Returns the longest prefix (possibly empty) of characters that satisfy
130+
the predicate:
128131

129132
#### `dropWhile`
130133

@@ -196,7 +199,8 @@ localeCompare :: String -> String -> Number
196199

197200
Locale-aware sort order comparison. Returns a negative number if the
198201
first string occurs before the second in a sort, a positive number
199-
if the first string occurs after the second, and 0 if they occur at the same level.
202+
if the first string occurs after the second, and `0` if their sort order
203+
is equal.
200204

201205
#### `replace`
202206

@@ -269,9 +273,9 @@ Returns the argument converted to uppercase.
269273
trim :: String -> String
270274
```
271275

272-
Removes whitespace from the beginning and end of a string, where
273-
whitespace means all the whitespace characters (space, tab, no-break
274-
space, etc.) and all the line terminator characters (LF, CR, etc.).
276+
Removes whitespace from the beginning and end of a string, including
277+
[whitespace characters](http://www.ecma-international.org/ecma-262/5.1/#sec-7.2)
278+
and [line terminators](http://www.ecma-international.org/ecma-262/5.1/#sec-7.3).
275279

276280
#### `joinWith`
277281

@@ -288,7 +292,7 @@ as separator between them.
288292

289293
Wraps Javascript's `RegExp` object that enables matching strings with
290294
patternes defined by regular expressions.
291-
For examples and details of the underlying implementation, see [RegExp Reference at MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/RegExp).
295+
For details of the underlying implementation, see [RegExp Reference at MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/RegExp).
292296

293297
#### `Regex`
294298

src/Data/Char/Char.purs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,13 +29,16 @@ module Data.Char
2929
}
3030
""" :: Number -> Char
3131

32+
-- | Characters can be compared for equality with `==` and `/=`.
3233
instance eqChar :: Eq Char where
3334
(==) (Char a) (Char b) = a == b
3435

3536
(/=) a b = not (a == b)
3637

38+
-- | Characters can be compared with `compare`, `>`, `>=`, `<` and `<=`.
3739
instance ordChar :: Ord Char where
3840
compare (Char a) (Char b) = a `compare` b
3941

42+
-- | Characters can be rendered as a string with `show`.
4043
instance showChar :: Show Char where
4144
show (Char s) = "Char " ++ show s

src/Data/String.purs

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
-- | Wraps the functions of Javascript's `String` object.
22
-- | A String represents a sequence of characters.
3-
-- | For examples and details of the underlying implementation, see [String Reference at MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String).
3+
-- | For details of the underlying implementation, see [String Reference at MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String).
44
module Data.String
55
(
66
charAt,
@@ -77,8 +77,8 @@ module Data.String
7777
uncons s | null s = Nothing
7878
uncons s = Just {head : U.charAt 0 s, tail : drop 1 s}
7979

80-
-- | Returns the longest prefix (possibly empty) of characters that satisfy the
81-
-- | predicate:
80+
-- | Returns the longest prefix (possibly empty) of characters that satisfy
81+
-- | the predicate:
8282
takeWhile :: (Char -> Boolean) -> String -> String
8383
takeWhile p s = take (count p s) s
8484

@@ -154,7 +154,8 @@ module Data.String
154154

155155
-- | Locale-aware sort order comparison. Returns a negative number if the
156156
-- | first string occurs before the second in a sort, a positive number
157-
-- | if the first string occurs after the second, and 0 if they occur at the same level.
157+
-- | if the first string occurs after the second, and `0` if their sort order
158+
-- | is equal.
158159
foreign import localeCompare
159160
"""
160161
function localeCompare(s1) {
@@ -243,9 +244,9 @@ module Data.String
243244
}
244245
""" :: String -> String
245246

246-
-- | Removes whitespace from the beginning and end of a string, where
247-
-- | whitespace means all the whitespace characters (space, tab, no-break
248-
-- | space, etc.) and all the line terminator characters (LF, CR, etc.).
247+
-- | Removes whitespace from the beginning and end of a string, including
248+
-- | [whitespace characters](http://www.ecma-international.org/ecma-262/5.1/#sec-7.2)
249+
-- | and [line terminators](http://www.ecma-international.org/ecma-262/5.1/#sec-7.3).
249250
foreign import trim
250251
"""
251252
function trim(s) {

src/Data/String/Regex.purs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
-- | Wraps Javascript's `RegExp` object that enables matching strings with
22
-- | patternes defined by regular expressions.
3-
-- | For examples and details of the underlying implementation, see [RegExp Reference at MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/RegExp).
3+
-- | For details of the underlying implementation, see [RegExp Reference at MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/RegExp).
44
module Data.String.Regex
55
( Regex(..)
66
, RegexFlags(..)

0 commit comments

Comments
 (0)