Left biased and right biased?

I read an article about partial unification , and the author mentioned objects with left and right offsets .
Can someone please explain this to me what are the left and right biased data types ?
What does this have to do with Function1 ?
Is Eitherleft or right offset?

+4
source share
1 answer

I will give a slightly broader answer, I hope you do not mind.

ADT or Algebraic data types can be divided into sum types and product types . This does not apply to Scala, but to the concept of general functional programming.

Product types are such that they include several basic types with and between implicit Booleans . For example, Student is the name FirstName and LastName, as well as Age and CoursesEnrolled. On the other hand, the types of amounts are implicit or in between. For example, a car is a Porsche, Audi or Ferrari.

In Scala, product types are most often modeled as case classes, and sum types are modeled as hierarchies, where a base feature or abstract class is inherited by all possible instances (often case classes). Given our previous examples, Student will

case class Student(firstName: String, lastName: String, age: Int, classesEnrolled: Vector[Course]) 

and car will

sealed trait Car
trait Porsche extends Car
trait Audi extends Car
trait Ferrari extends Car

, , . , case .. . , FYI: FP- Scala, , , .. .

; . : "", "", "" Scala, . map flatMap " " (Some for Option, Right for Either ..) ( None, ..).

, . , , map flatMap, " " " ", - . , Scala 2.12, , , - . , . " ", , , ( , .., ).

, , Scala 2.12. , IMHO . , \/(scalaz dicjuntion), . .

, " Function1". . , map flatMap (, ..).

+4

Source: https://habr.com/ru/post/1693566/


All Articles