Tag Archives: scala

Compound Types in Scala

Compound Types in Scala In the previous post we looked at Mixin composition with traits in Scala. This post is about a similar concept, called Compound types. The syntax is exactly the same, it uses the familiar with keyword. But there is some differences. Mixins are used to define types or instantiating them. On the… Continue reading »

PartialFunction (Partially defined functions) In Scala

PartialFunction (Partially defined functions) In Scala A partial function is a unary function which is only defined for certain domain (i.e. input) values. They can be introduced anonymously. They can also be defined using PartialFunction trait. In order to understand partial functions, first introduce a type Student. It has three properties, id, sType and name… Continue reading »

Currying in Scala

Currying in Scala In our .net blog [shujaat.net], we have discussed about currying in details. Just to quote from there: Currying is a transformation technique in functional programming space. It is used to convert a function with multiple parameters to a set of functions with single parameter each. It can be used to create refined… Continue reading »

Structural Sub Typing in Scala

Structural Sub Typing in Scala

Structural Sub Typing in Scala Structural typing is compile time checked duck-typing. It allows us to specify the characteristics of a required type instead of an actual concrete type. Let’s create a new SBT project ScalaTyping. In this post we are going to discuss how Scala supports structural sub-typing. Let’s create a simple Scala SBT… Continue reading »