Haskell: Integral Parameter
Noob Haskell question: Let's say that I have a function that calculates the cost of booking airline tickets according to some market-driven formula:
Code:
-- total cost for n numbers of persons traveling together After some experimentation I discovered that if I passed in a special option to the compiler I could do this: Code:
cost (n :: Integer) = if n < 0 then error "cost of negative travelers invalid" |
All times are GMT -5. The time now is 01:58 AM. |