                    (FunctionType         (list type) type range))
 (typ constructor   (SimpleConstructor    (list int32) range)
                    (ComplexConstructor   (list int32) (list type) range))
+(typ pattern       (Capture              (list int32) range)
+                   (ConstructorPattern   (list int32) (list pattern) range))
 (typ expression    (IntegerConstant      int32 range)
                    (Identifier           (list int32) range)
                    (Lambda               (list (list int32))

(def function-arguments-to-sexp (arguments range)
     (List (list-map (fn (name) (Symbol name range)) arguments) range))

(def match-pair-to-sexp (pair)
     (match pair
            (Pair pattern expression)
               (Cons (expression-to-sexp pattern)
               (Cons (expression-to-sexp expression) Empty))))

(def expression-to-sexp (expression)

                              (FunctionApplication expressions range))))
         expressions))

(def sexp-to-pattern (sexp)
     (match sexp
            (List (Cons name rest) range)
                  (result-flatmap (fn (patterns)
                  (result-first   (fn (name)
                                      (ConstructorPattern name patterns range))
                                (symbol-to-string name)))
                                (result-of-list (list-map sexp-to-pattern rest)))
            (List Empty range)
                  (Error (MalformedExpressionError range))
            (Symbol name range)
                  (Result (Capture name range))))

(def sexp-to-match-pair (pair)
     (match pair
            (Pair pattern expression)
