4 ms·
Haskell is lazy, you can write a bunch of expressions and use the results of those expressions in other expressions and so on. For example: foo :: Int -> Int
by ankurdhama 8y ago
Haskell is lazy, you can write a bunch of expressions and use the results of those expressions in other expressions and so on. For example:
foo :: Int -> Int
foo a = let
z = a * c
b = 10
c = 20
in
b + c + z
I used c is z but c is defined later. The language allows you to defined the expressions in any order but internally it will have to figure out the dependencies between the expressions and execute them in specific order and also while writing code and coming up with the logic of the algorithm you will have to think about what you want to compute first and what to compute next.