diff --git a/CHANGELOG.md b/CHANGELOG.md index d7e5af83..27b3952a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,7 @@ Breaking changes: New features: Bugfixes: +- Fixed `Semigroup.append` broken for `Array` (#4 by @Renegatto) Other improvements: diff --git a/src/Data/Semigroup.lua b/src/Data/Semigroup.lua index 22165467..6949b09a 100644 --- a/src/Data/Semigroup.lua +++ b/src/Data/Semigroup.lua @@ -4,7 +4,15 @@ return { return function(ys) if #xs == 0 then return ys end if #ys == 0 then return xs end - return table.concat(xs, ys) + local result = {} + for index, value in ipairs(xs) do + result[index] = value + end + local offset = #result + for index, value in ipairs(ys) do + result[index + offset] = value + end + return result end end) }