Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ Other improvements:
- Added clearer docs for Prelude module (#270 by @JordanMartinez)
- Clarify docs for `flip` (#271 by @JordanMartinez)
- Add comment that `Number` is not a fully law abiding instance of `Ord` (#277 by @JamieBallingall)
- The internal FFI function `join` in `Data.Show` has been renamed to `intercalate` to
match the same function in `Data.Show.Generic` (#274 by @cdepillabout)

## [v5.0.1](https://github.com/purescript/purescript-prelude/releases/tag/v5.0.1) - 2021-05-11

Expand Down
2 changes: 1 addition & 1 deletion src/Data/Show.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ export const cons = function (head) {
};
};

export const join = function (separator) {
export const intercalate = function (separator) {
return function (xs) {
return xs.join(separator);
};
Expand Down
6 changes: 3 additions & 3 deletions src/Data/Show.purs
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ instance showProxy :: Show (Proxy a) where
instance showRecord :: (RL.RowToList rs ls, ShowRecordFields ls rs) => Show (Record rs) where
show record = case showRecordFields (Proxy :: Proxy ls) record of
[] -> "{}"
fields -> join " " [ "{", join ", " fields, "}" ]
fields -> intercalate " " ["{", intercalate ", " fields, "}"]

-- | A class for records where all fields have `Show` instances, used to
-- | implement the `Show` instance for records.
Expand All @@ -61,7 +61,7 @@ instance showRecordFieldsCons ::
, Show focus
) =>
ShowRecordFields (RL.Cons key focus rowlistTail) row where
showRecordFields _ record = cons (join ": " [ key, show focus ]) tail
showRecordFields _ record = cons (intercalate ": " [ key, show focus ]) tail
where
key = reflectSymbol (Proxy :: Proxy key)
focus = unsafeGet key record :: focus
Expand All @@ -73,4 +73,4 @@ foreign import showCharImpl :: Char -> String
foreign import showStringImpl :: String -> String
foreign import showArrayImpl :: forall a. (a -> String) -> Array a -> String
foreign import cons :: forall a. a -> Array a -> Array a
foreign import join :: String -> Array String -> String
foreign import intercalate :: String -> Array String -> String
9 changes: 1 addition & 8 deletions src/Data/Show/Generic.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,5 @@
export const intercalate = function (separator) {
return function (xs) {
var len = xs.length;
if (len === 0) return "";

var res = xs[0];
for (var i = 1; i < len; i++) {
res = res + separator + xs[i];
}
return res;
return xs.join(separator);
};
};