Hindley-Milner type inferencer (algorithm W) implemented by Scala