alleycats - no default instance for Empty[Option[T]]
Open
Nobody has claimed this yet.
- Dominant language
- Scala
- Stars
- 5.5k
- Forks
- 1.2k
- Avg merge
- 2d 10h
- Merged PRs (30d)
- 5
Description
There is no default instance for Empty[Option[T]] if T has no Monoid. But there is one for collections.
Would it make sense to add an Empty[Option[T]] instance that behaves like the collection default ones?
import alleycats.Empty
import cats.implicits._
import java.time.LocalDateTime
implicit val dtEmtpy = Empty(new LocalDateTime(0))
// works fine
Empty[List[LocalDateTime]]
Empty[Set[LocalDateTime]]
Empty[Stream[LocalDateTime]]
// doesn't work by default
Empty[Option[LocalDateTime]]
EDIT: rewrite the example with a type that has no Monoid.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by locating the existing alleycats.Empty instances for collections and the current handling of Option. Check how the instance should behave when the contained type has no Monoid, then add focused coverage showing the intended Empty[Option[T]] behavior for such a type.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- scala
- Domain
- tooling
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100