Search⌘ K
AI Features

Predefined Functions on Numbers

Understand how to use Haskell's predefined numeric functions from the Prelude module. Learn to perform power operations, integer division with div, compute remainders using mod, and convert between numeric types with fromIntegral and round. This lesson guides you through practical examples and Haskell syntax to handle numbers effectively.

We'll cover the following...

Apart from the arithmetic operators +, -, *, /, there are quite a few useful predefined functions for working with numbers. These functions live in a predefined Haskell module called Prelude. When starting ghci, it loads the Prelude module by default, which is why you also see it displayed in the prompt of ghci.

Once again, here is a terminal widget, which you can use to run ...