 dsl_type = ->
 dsl = type: dsl_type
 
-create_type = (n, parent) ->
-  t = (@values...) -> @type = n
+create_type = (n, parent, f) ->
+  t = (args...) ->
+    @type = n
+    f.apply @, args
   t.prototype = new parent
   dsl_type[n] = t
 

    if _.isFunction object
      Context.add_component ctx, React.DOM.div null,
        "#{lead_string} is a server function"
        Components.ExampleComponent value: "help 'server.functions.#{object.values[0]}'", run: true
    else
      Context.add_component ctx, React.DOM.div null,
        "What do you want to do with #{lead_string}?"


dsl_fn = (name) ->
  result = (args...) ->
    new dsl.type.f name, (process_arg arg for arg in args)
  result.type = 'i'
  result.fn_name = name
  result.value = name
  # TODO this will break f.bind() etc.
  result.__proto__ = new dsl.type.i

