package nl.utwente.group10.haskell.type;

import com.google.common.base.Joiner;

/**
 * Constant, concrete type. However, it may consist of variable types.
 */
public class ConstT extends Type {
    /**
     * The constructor for this type.
     */
    private final String constructor;

    /**
     * The types of the arguments for this type.
     */
    private final Type[] args;

    /**
     * @param constructor The constructor for this constant type.
     * @param args The types of the arguments that this type accepts.
     */
    public ConstT(final String constructor, final Type ... args) {
        this.constructor = constructor;
        this.args = args;
    }

    /**
     * @return The constructor for this type.
     */
    public final String getConstructor() {
        return this.constructor;
    }

    /**
     * @return The types of the arguments for this type.
     */
    public final Type[] getArgs() {
        return this.args;
    }

    @Override
    public final Type prune() {
        for (int i = 0; i < this.args.length; i++) {
            this.args[i] = this.args[i].prune();
        }

        return this;
    }

    @Override
    public String toHaskellType() {
        StringBuilder out = new StringBuilder();
        out.append(this.constructor);

        for (int i = 0; i < this.args.length; i++) {
            out.append(" ");
            out.append(this.args[i].toHaskellType());
        }

        return out.toString();
    }

    @Override
    public String toString() {
        if (this.args.length > 0) {
            return String.format("(%s %s)", this.constructor, Joiner.on(' ').join(this.args));
        } else {
            return this.constructor;
        }
    }
}

@@ -1161,32 +1161,38 @@
 ride%0A    public 
+final 
 String toHaskell
@@ -1305,44 +1305,28 @@
 or (
-int i = 0; i %3C this.args.length; i++
+Type arg : this.args
 ) %7B%0A
@@ -1377,28 +1377,19 @@
 .append(
-this.args%5Bi%5D
+arg
 .toHaske
@@ -1473,16 +1473,22 @@
  public 
+final 
 String t

Make some methods final, clean up some code