I'm trying to make a little program in Haskell. What I need to do is to check if a bash command has been executed successfully by the Haskell interpreter. Let's say in "pseudocode":

  $import System

  $if( system "ls" ) has been succesfully run 
  $then doStuff


How would you write this piece of code in Haskell?


Question: Simple static integer stack
Answer: this is not always needed in member functions, you can remove all the 

this-&gt;


The compiler knows this from the context.

And move brackets, e.g.:

int myStaticIntStack::peek() {
    if( 0 == storedElements ){
        cout &lt;&lt; "Stack is empty, you must PUSH an element before PEEKing one!" &lt;&lt; endl;
        return -1;
    }
    else{
        return elements[stackSize - storedElements ];
    }
}


In comparisons, the const is safer on the left.  This avoids a possible =, which is a common error.

You could improve it by making a vector class. You may have to do this from scratch if it is homework. It would be better than old C arrays.