                             (ComplexType name sub-types range))
                         (result-of-list (list-map sexp-to-type parameters)))
         (Symbol name range)                             (Result (SimpleType name range))
-        _                                               (Error MalformedTypeError)))
+        (List _ range)                                  (Error (MalformedTypeError range))))
 
 (def sexp-to-definition' (kind name rest range)
     (match (type-definition? (symbol-name kind))

        (Symbol name _)  name
        _                Empty))

(def transform (value f)
    (f value))

(typ type          (SimpleType          (list int32) range)
                   (ComplexType         (list int32) (list type) range))
(typ definition    (TypeDefinition      type sexp range)
                   (OptOut              sexp))

(typ error         MalformedDefinitionError
                   MalformedTypeError)



(def type-definition? (type)

(def sexp-to-definition (expression)
     (match expression
        (List (Cons kind (Cons name rest)) range)  (sexp-to-definition' kind name rest range)
        (List _ range)                             (Error (MalformedDefinitionError range))
        (Symbol _ range)                           (Error (MalformedDefinitionError range))))

(def sexps-to-definitions (expressions)
    (list-map sexp-to-definition expressions))
