Skip to content

Commit

Permalink
fix Traversable instance for ListL
Browse files Browse the repository at this point in the history
  • Loading branch information
marcosh committed Sep 28, 2023
1 parent 3b9f182 commit 0414063
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 3 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic versioning](http://semver.org/).

## [1.4.1] - 2023-09-28

- fix `Traversable` instance for `ListL`

## [1.4.0] - 2023-09-27

- introduce `OppositeSemigroup` and `OppositMonoid`
Expand Down
2 changes: 1 addition & 1 deletion src/Instances/ListL/ListTraversable.php
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ public function traverse(Applicative $applicative, callable $f, HK1 $a): HK1
* @param HK1<ListBrand, B> $t
* @return HK1<ListBrand, B>
*/
static fn ($h, $t): HK1 => ListL::fromBrand($t)->append($h),
static fn ($h, $t): HK1 => ListL::fromBrand($t)->prepend($h),
$f($c),
$d
),
Expand Down
4 changes: 2 additions & 2 deletions src/ListL.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,9 @@ public function asNativeList(): array
* @param A $a
* @return ListL<A>
*/
public function append($a): self
public function prepend($a): self
{
return new self(array_merge($this->list, [$a]));
return new self(array_merge([$a], $this->list));
}

/**
Expand Down

0 comments on commit 0414063

Please sign in to comment.