Question about "constant" declaration

I have a beginner question about “constant” declaration. I am not sure if “constant” is the right term here. So far, I have seen the following ways to declare some kind of fixed value.

foo = 1

bar :: Int
bar = 2

baz = 3 :: Int

What is the recommended approach for production code?

1 Like

I would say

bar :: Int
bar = 2

(top-level signature) is what you see in 99% of the cases.

9 Likes