On Thu, 9 Oct 2008, Iain Barnett wrote:
If I were to create an object in C#, for instance, I could add code to the
constructor that might limit the type further e.g.
public class Car
{
string model;
int wheels;
public Car ( string model, int no_of_wheels )
{
if ( no_of_wheels <= 2 ) {
throw new Exception( "a car must have at least 3
wheels");
}
this.model = model;
this.no_of_wheels = no_of_wheels;
}
}
I think it is not the right way to handle the number of wheels with an
exception. This should be considered an error.
http://www.haskell.org/haskellwiki/Error
_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe