Few programs in Scala and Haskell