             #     params: paramNames
             #     body: (join compiledWheres, [(jsReturn compiledBody)]))])
 
+# Assumes definition name
+assignExplicitType = (ctx, type) ->
+  explicitType = quantifyUnbound ctx, type
+  name = ctx.definitionName()
+  if ctx.isTyped name
+    malformed ctx.definitionPattern(), 'This name is already taken'
+  else
+    ctx.assignType name, explicitType
+  explicitType
+
 ms.type = ms_type = (ctx, call) ->
   hasName = requireName ctx, 'Name required to declare new type alias'
   alias = ctx.definitionName()

        ctx.declareArity name, paramNames
        # Explicit typing
        if type
          explicitType = quantifyUnbound ctx, typeConstrainedCompile ctx, type
          if ctx.isTyped name
            malformed ctx.definitionPattern(), 'This name is already taken'
          else
            ctx.assignType name, explicitType

      paramTypeVars = map (-> ctx.freshTypeVariable star), params
      paramTypes = map (__ toForAll, toConstrained), paramTypeVars

      (call_ (token_ 'data'),
        [typeParamTuple, (token_ ctx.definitionName()), (tuple_ args)])

  # Type an expression
ms[':'] = ms_typed = (ctx, call) ->
    hasName = requireName ctx, 'Name required to declare typed values for now'
    [type, constraintSeq, rest...] = _arguments call
    compiledType =
      if isSeq constraintSeq
        constraints = typeConstraintsCompile ctx, _terms constraintSeq
        if type
          new Constrained constraints, typeCompile ctx, type
      else
        typeConstrainedCompile ctx, call
    if hasName
      ctx.declare ctx.definitionName()
      assignExplicitType ctx, compiledType
    # TODO: support typing of expressions,
    #watch out of definition patterns without a name
    jsNoop()


# Adds a class to the scope or defers if superclass doesn't exist
ms.class = ms_class = (ctx, call) ->
    hasName = requireName ctx, 'Name required to declare a new class'
    [paramList, defs...] = _validArguments call
