Oleg Nizhnik's Avatar

Oleg Nizhnik

@odomontois

Scala dev simping category theorists, enjoying inappropriate CS

17
Followers
19
Following
5
Posts
16.04.2024
Joined
Posts Following

Latest posts by Oleg Nizhnik @odomontois

Preview
Scastie - An interactive playground for Scala. import scala.annotation.tailrec //very poor performance pseudo monad sealed trait Tail[+A] { import Tail.* def flatMap[B](f: A => Tail[B]): Tail[B]^{this, f} = this match case Now(value) => ...

Interestingly enough, the `transparent` modifier to an inline def can not only narrow the resulting type, but also widen it, if the widening implies extending the capture set.
scastie.scala-lang.org/Odomontois/6...

02.10.2025 14:02 ๐Ÿ‘ 0 ๐Ÿ” 0 ๐Ÿ’ฌ 0 ๐Ÿ“Œ 0

The important lesson of the Coyoneda structure for scala is that whenever your datastructure has a Functor instance it could be covariant

30.09.2025 13:29 ๐Ÿ‘ 0 ๐Ÿ” 0 ๐Ÿ’ฌ 0 ๐Ÿ“Œ 0
Preview
Scastie - An interactive playground for Scala. def foo(src: String): Option[List[Int] -> Int] = None def traverse[A, B](xs: List[A], f: A => Option[B]): Option[List[B]] = None val weird = for actions <- traverse(List[String](), foo) _ = acti...

Ok, syntax extensions and java classes don't matter it's only capture checking and generics
scastie.scala-lang.org/Odomontois/G...

22.09.2025 15:39 ๐Ÿ‘ 0 ๐Ÿ” 0 ๐Ÿ’ฌ 0 ๐Ÿ“Œ 0
Preview
Scastie - An interactive playground for Scala. import cats.syntax.all.given val buf = StringBuffer() def foo(src: String): Either[String, StringBuffer -> Unit] = for x <- Right(1) yield _.append(x) val strs = List("a", "b", "c") val weird ...

Encountered a weird behaviour of capture-checking treating a combination of java classes and generic synthax extensions
scastie.scala-lang.org/Odomontois/z...

22.09.2025 15:14 ๐Ÿ‘ 0 ๐Ÿ” 1 ๐Ÿ’ฌ 1 ๐Ÿ“Œ 0

A fantastic day not reading posts on twitter.

08.09.2025 08:46 ๐Ÿ‘ 0 ๐Ÿ” 0 ๐Ÿ’ฌ 0 ๐Ÿ“Œ 0