 filterSet =
 filterMap = (fn, set) ->
   initialized = newMap()
-  for key, val of set.values when fn key
+  for key, val of set.values when fn key, val
     addToMap initialized, key, val
   initialized
 

  vars: map.values

findFree = (type) ->
  if type instanceof TypeVariable
    newMapWith type.name, type.kind
  else if type instanceof TypeApp
    concatMaps (findFree type.op), (findFree type.arg)
  else if type instanceof Constrained
    concatMaps (findFreeInList type.constraints), (findFree type.type)
  else if type instanceof ClassConstraint
    findFree type.types
  else if type instanceof Types
    findFreeInList type.types
  else
    newMap()

    applyKindFn (applyKindFn fn, arg), args...

isConstructor = (type) ->
  type.TypeApp

kind = (type) ->
  if type.kind
    type.kind
  else if type.TypeApp
    (kind type.op).to
  else
    console.log "invalid", type
    throw new Error "Invalid type in kind"

kindsEq = (k1, k2) ->
