Releases: kevin-lee/just-fp
v1.6.0
v1.5.0
v1.4.0
1.4.0 - 2021-04-18
Done
- Add
OptionT
(#132) Add the document site using(#142)sbt-microsites
- Add core sub-project (#143)
- Replace
sbt-microsites
withDocusaurus
(#165) - Build for Dotty (#170)
Support Scala(#180)3.0.0-M2
- Support
Scala, Scala3.0.0-M3
3.0.0-RC1
and Scala3.0.0-RC2
(#186) - Use
Scalafix
(#190) - Drop Scala
3.0.0-M*
support (#192)
v1.3.5
v1.3.4
v1.3.3
v1.3.2
v1.3.1
1.3.1 - 2019-10-15
Done
-
Add apply method to the companion objects of typeclasses (#102)
This
implicitly[Monoid[List[A]]].zero // List[Int] = List()
can be now
Monoid[List[Int]].zero // List[Int] = List()
Also for the following typeclasses
-
Equal
e.g) when there is the instance of
Equal[A]
typeclassEqual[List[Int]].equal(List(1, 2, 3), List(1, 2, 3)) // true
-
SemiGroup
SemiGroup[Int].append(1, 2) // Int = 3
-
Monoid
Monoid[List[Int]].append(List(1, 2, 3), Monoid[List[Int]].zero) // List[Int] = List(1, 2, 3)
-
Functor
Functor[Option].map(1.some)(_ + 99) // Option[Int] = Some(100)
-
Applicative
Applicative[List].ap(List(1, 2, 3))(List[Int => Int](n => n * 2, _ + 99)) // List[Int] = List(2, 4, 6, 100, 101, 102)
-
Monad
Monad[Option].flatMap(1.some)(n => (n + 99).some) // Option[Int] = Some(100)
-
-
Add
isZero
toMonoid
(#104)e.g.)
Monoid[List[Int]].isZero(Monoid[List[Int]].zero) // true Monoid[List[Int]].isZero(List()) // true Monoid[List[Int]].isZero(List(1, 2, 3)) // false
-
Add
nonZero
toMonoid
(#106)e.g.)
Monoid[List[Int]].nonZero(Monoid[List[Int]].zero) // false Monoid[List[Int]].nonZero(List()) // false Monoid[List[Int]].nonZero(List(1, 2, 3)) // true
v1.3.0
1.3.0 - 2019-10-13
Done
-
Add writer syntax (#89)
e.g.)
1.writer("Get value") // Writer[String,Int] = WriterT(("Get value",1)) // WriterT[Id, String, Int] "something".writer(List("something happened")) // Writer[List[String],String] = WriterT((List("something happened"),"something")) // WriterT[Id, List[String], String]
-
Add
Writer
constructor for(W, A)
(#87)e.g.)
for { a <- Writer.writer(("abc", 1)) b <- Writer.writer(("def", a)) } yield b // WriterT[Id,String,Int] = WriterT(("abcdef",1))
-
Add
mappend
syntax forSemiGroup
andMonoid
(#80)mappend syntax for SemiGroup and Monoid. append is too common name so there can be conflict in names with other types. So use mappend (short name for Monoid append) instead of append.
1.mappend(2) // Int = 3 "abc".mappend("def") // String = abcdef List(1, 2, 3).mappend(List(4, 5, 6)) // List[Int] = List(1, 2, 3, 4, 5, 6)
-
Add
OptionSemiGroup
andOptionMonoid
(#82)Add
OptionSemiGroup
to makeOption[A]
SemiGroup[A]
andOptionMonoid
to makeOption[A]
Monoid[A]
ifSemiGroup[A]
exists.1.some |+| 999.some // Option[Int] = Some(1000) 1.some.mappend(999.some) // Option[Int] = Some(1000) 123.some |+| none[Int] // Option[Int] = Some(123) none[Int] |+| 999.some // Option[Int] = Some(999) List(1, 2, 3).some |+| List(4, 5, 6).some // Option[List[Int]] = Some(List(1, 2, 3, 4, 5, 6)) List(1, 2, 3).some |+| none[List[Int]] // Option[List[Int]] = Some(List(1, 2, 3)) none[List[Int]] |+| List(1, 2, 3).some // Option[List[Int]] = Some(List(1, 2, 3))
v1.2.0
1.2.0 - 2019-09-21
Done
-
Replace
?
with*
(#68) -
Change
JustSyntax
tosyntax
(#71)import just.fp.syntax._
-
Add
OptionSyntax
(#72)1.some // Option[Int] = Some(1) none[String] // Option[String] = None
-
Add
toEither
toOptionSyntax
(#75)val maybeN = 1.some // Option[Int] = Some(1) maybeN.toEither("Something wrong") // Either[String, Int] = Right(1) val maybeN2 = none[Int] // Option[Int] = None maybeN2.toEither("Something wrong") // Either[String, Int] = Left("Something wrong")