juan_gandhi: (Default)

John De Goes is Programming Without Type Classes



Type classes have become a cornerstone of statically-typed functional programming, powering abstractions like monoid and monad. Yet, type classes often have generalized names, which don’t reflect their purpose in specific domains; and they incur higher learning costs, especially when emulated in languages without them.

In this presentation, John De Goes discusses the pros and cons of using type classes, and presents a systematic method for building powerful functional components that do not require type classes. Attendees will learn how to preserve the benefits of principled, algebraic functional programming, without forcing type classes on coworkers or users.
juan_gandhi: (Default)
Юджин Йокота деплойнул sbt в jfrog, вместо чего-то там.

В результате по всей планете билды скальных продуктов сломаны.

Вот это заебись надежность. Я вообще не понимаю, как можно бесконтрольные апдейты устраивать.
juan_gandhi: (Default)
Had a discussion yesterday. Basically, about this equality:

scala> "abc": Iterable[Char]
val res0: Iterable[Char] = abc

scala> List('a', 'b', 'c'): Iterable[Char]
val res1: Iterable[Char] = List(a, b, c)

scala> res0 == res1                                                                                                        
val res2: Boolean = true


No surprise, just making sure that it behaves as expected. Two projections are equal.
juan_gandhi: (Default)
Вот простые два теста на Котлине.

    Stream.of<String>().forAll {   it.isEmpty() } shouldBe true
Stream.of<String>().forAll { !it.isEmpty() } shouldBe true



Не очень понятно, как это непрофессионалы воспримут. Моим студентам требуются усилия обычно.





munit

Dec. 24th, 2020 07:06 am
juan_gandhi: (Default)
 Послушал тут доклад на мадридском митапе, про munit - ну как-то не вижу смысла; junit надоел хуже горькой редьки, а этот не особо далеко ушел, только что stack trace highlighting. Я уж лучше specs2 продолжу использовать.

Или?
juan_gandhi: (Default)

def x: { def k: Int } = new { def k: Int = 42 }

 

juan_gandhi: (Default)
 Just figured, `_` in Scala is an example of anaphora.
juan_gandhi: (Default)
Что в ScalaZ ноль тестов для OptionT. Я им когда-то навалял тест для finger trees, ну и. Короче, за столько лет если не сбацали, так и все уже, наверно. Хм. Это я хотел поэкспериментировать. Потому что не совсем понимаю причин коммутирования (и могу привести простой контрпример). Пошел смотреть, как оно в typelevel/cats. In short. Have to use cats. Probably not. Will take a look at ZIO later.
juan_gandhi: (Default)
Ночью приходил енот, помыл кошкину миску. Почему этого енота не записала камера, непонятно.

Regarding type parameters and member types. Say, you have trait T[X]{}. With a certain caveat, you may view it as a functor. If you have trait T { type X }. We have a partial mapping that, given a type, produces X (or not).

We can as well view both as binary relations between types (or profunctors, if we go to categories). One is an inverse of another.

So when you choose which one to prefer, mind the meaning of it.

(inspired by Compall's blog from 2015.
juan_gandhi: (Default)
Welcome to Scala 2.12.8 (Java HotSpot(TM) 64-Bit Server VM, Java 1.8.0_92).
Type in expressions for evaluation. Or try :help.

scala> def f(x: Int) = 10 + x -> "ok"
f: (x: Int)(Int, String)

scala> f(10)
res0: (Int, String) = (20,ok)

scala> def g(x: Int) = 20 + x → "oops"
:11: error: overloaded method value + with alternatives:
  (x: Double)Double 
  (x: Float)Float 
  (x: Long)Long 
  (x: Int)Int 
  (x: Char)Int 
  (x: Short)Int 
  (x: Byte)Int 
  (x: String)String
 cannot be applied to ((Int, String))
       def g(x: Int) = 20 + x → "oops"
                          ^

Profile

juan_gandhi: (Default)
Juan-Carlos Gandhi

September 2025

S M T W T F S
 1 23456
78910111213
14151617181920
21222324252627
282930    

Syndicate

RSS Atom

Most Popular Tags

Style Credit

Expand Cut Tags

No cut tags
Page generated Sep. 3rd, 2025 10:36 pm
Powered by Dreamwidth Studios