   (isFunctionType type) and (returnType = functionReturnType type) and
     (not returnType.QuantifiedVar) and returnType
 
+curriedType = (type) ->
+  if type.arg and isFunctionType type.arg
+    curriedType type.arg
+  else
+    type
+
 functionReturnType = (type) ->
   if type.arg and isFunctionType type
     functionReturnType type.arg

    # {a b c} to (& a (& b (& c)))
    # expressionCompile ctx, arrayToConses elems
    # result =>         "[#{listOf map _compiled, elems}]"

    compiledItems = uniformCollectionCompile ctx, form, elems, arrayType
    assignCompile ctx, form, (irArray compiledItems)

  ctx = new Context
  [typed, untyped] = unzip (for definitions, i in definitionLists
    isValid = (name, def) ->
      def.type? and not def.type.TempType and (not isPattern or (isConst symbol: name) or def.isPattern)# and def.type.type?.constraints and _empty def.type.type.constraints
    validDefinitions = filterMap isValid, definitions # TODO: filter before TempType
    validDefinitions = concatMaps validDefinitions,
      (for name, def of values validDefinitions when def.arity and returnType = concreteReturnType def.type
        newMapWith "(#{name} #{Array(def.arity.length).join ' '})", {
          type: new ForAll def.type.kinds, new Constrained [], returnType
          docs: def.docs
          fabricated: yes},
        "(#{name} #{Array(def.arity.length - 1).join ' '})", {
          type: new ForAll def.type.kinds, new Constrained [], curriedType def.type.type.type
          docs: def.docs
          fabricated: yes})...
    # typesUnify = (def) ->
    #   not isFailed mostGeneralUnifier (freshInstance ctx, def.type).type, type.type
    # [typed, notTyped] = partitionMap typesUnify, validDefinitions
