vinothkr
vinothkr

Reputation: 1270

Haskell static computation

I was reading the "Fun with functional dependencies"

This part is said to statically computed ie performed at the compile time

data Nat = Zero | Succ Nat
three = Succ(Succ(Succ Zero)))
even Zero = True
even (Succ n) = odd n
odd Zero = False
odd (Succ n) = even n

(odd three)

But I don't quite get what would be statically computed. And I also don't find anything unusual the compiler to compute to check types

Upvotes: 3

Views: 171

Answers (1)

sepp2k
sepp2k

Reputation: 370425

Nothing in that code is computed statically. Note that the code you've posted is from the section "Dynamic Computation", not "Static Computation".

Upvotes: 12

Related Questions