Skip to content

Instantly share code, notes, and snippets.

View mossprescott's full-sized avatar

Moss Prescott mossprescott

View GitHub Profile

EDIT: This gist has been promoted and is now a blog post.

Kinda-Curried Type Parameters

Scala methods can have multiple lists of value parameters but only one list of type parameters, which is occasionally irritating when some are inferable and others are not. Consider this method which has two type parameters, one inferable and one not.

import scalaz._, Scalaz._
293 nodes remain after consolidating to typer time >= 100 ms.
(1) Total time spent typing node (in ms)
(2) "Own" time (Total time - children's time)
(3) Monotonically increasing id assigned to nodes
(4) Textual content characterizing AST node
(5) Line in source file
(1)/(2) (3) (4) (5)
--------------------------------------------------------------------------------