     map (syntaxNewName 'Parameter name expected'), params
   params
 
+declareMethods = (ctx, className, paramNames, methodDeclarations) ->
+  # TODO: all occurences of a param should have the same kind and all methods
+  #       should have at least one occurence of some param
+  #   freeInMethods = mapMap ((d) -> findFree d.type.type), methodDeclarations
+
+  for name, {arity, type} of values methodDeclarations
+    vars = findFree type.type
+    # TODO: support multi-param classes
+    [param] = paramNames
+    paramVar = new TypeVariable param, (lookupInMap vars, param)
+    constraint = new ClassContraint className, paramVar
+    type = quantifyUnbound ctx, addConstraints type.type, [constraint]
+    ctx.declare name, {arity, type}
+
 quantifyUnbound = (ctx, type) ->
-  vars = subtractSets (arrayToSet findFree type), ctx.allBoundTypeVariables()
+  vars = subtractSets (findFree type), ctx.allBoundTypeVariables()
   quantify vars, type
 
 # Takes a set of fixed type variables, a set of type variables which

  applyKindFn (tupleType elemTypes.length), (typesCompile elemTypes)...

typeConstantCompile = (atom) ->
  name = atom.symbol
  atom.label = 'typename'
  if /^[A-Z]/.test name
    typeConstant name
  else
    new TypeVariable name, star

typeConstantsCompile = (expressions) ->
  map typeConstantCompile, expressions


# Inside definition, we call assignCompile with its RHS
#   whether to call it and with what expression is left to the RHS expression


  allBoundTypeVariables: ->
    concatSets (for scope in @scopes
      scope.boundTypeVariables)...

  isClassDefined: (name) ->
    !!@classNamed name
