public void ReduceConstructorExpression()
        {
            var fn = new ConstructorFunction(new MapType(IntegerType.Instance, new MapType(IntegerType.Instance, IntegerType.Instance)));

            var expr = new ConstructorFunctionalExpression(fn, new IExpression[] { new IntegerExpression(1), new IntegerExpression(2) });

            Assert.AreSame(expr, expr.Reduce());
        }
        public ConstructorFunctionalExpression(ConstructorFunction head, IList<IExpression> args)
        {
            this.head = head;
            this.args = args;

            this.type = head.Type;

            for (int k = 0; k < args.Count; k++)
                this.type = ((MapType)this.type).ToType;
        }
        public void Match()
        {
            var fn = new ConstructorFunction(new MapType(IntegerType.Instance, new MapType(IntegerType.Instance, IntegerType.Instance)));

            var expr = new ConstructorFunctionalExpression(fn, new IExpression[] { new IntegerExpression(1), new IntegerExpression(2) });
            var expr2 = new ConstructorFunctionalExpression(fn, new IExpression[] { new IntegerExpression(1), new IntegerExpression(2) });
            var expr3 = new ConstructorFunctionalExpression(fn, new IExpression[] { new IntegerExpression(1), new IntegerExpression(3) });

            Assert.IsTrue(expr.Match(expr2, null));
            Assert.IsFalse(expr.Match(expr3, null));
        }