         (list-first in)))
   """
   "(first {42 43 44})", 42
+
+  'nested pattern matching'
+  """
+    f (fn [x]
+      y
+      [[z y] g] x)
+  """
+  "(f [[2 42] 3])", 42
   # The following doesn't work because the Collection type class specifies
   # that the constructor takes only one argument.
   #


class TypeVariable
  constructor: (@name, @kind) ->
class TypeConstr
  constructor: (@name, @kind) ->
class TypeApp
  constructor: (@op, @arg) ->
class QuantifiedVar
  constructor: (@var) ->
class ForAll
  constructor: (@kinds, @type) ->
class TempType
  constructor: (@type) ->

class Types
  constructor: (@types) ->

class Constrained
  constructor: (@constraints, @type) ->
class ClassConstraint
  constructor: (@className, @types) ->

addConstraints = ({constraints, type}, addedConstraints) ->
  new Constrained (join constraints, addedConstraints), type

  # if not translatedExpression # TODO: throw here?
  if ctx.isAtDefinition()
    to = ctx.definitionPattern()
    ctx.setAssignTo (irDefinition expression.tea, translatedExpression)
    {precs, assigns} = patternCompile ctx, to, expression
    translationCache = ctx.resetAssignTo()
