|20-CS-4003-001||Organization of Programming Languages||Fall 2017|
The Error Function
first (x:xs) = x first  = error "first  is a no go"
Haskell has a built-in function called error whose type is
String -> a. Thus, from a string, any output is possible.
The error function when a program should be terminated due
to a bad condition that cannot be recovered from.
The example to the left re-defines head as first. The new first functions behaves like head except when the argument is an empty list. head  will raise an exception, first  invokes error.