klequis / zz-haskell-notebook

Notes from learning Haskell
1 stars 0 forks source link

Bindings or Bound (local & top level) #4

Open klequis opened 2 years ago

klequis commented 2 years ago

Bindings or bound indicates connection, linkage or association between objects. In Haskell it is used to describe the relationship between a variable and its value.

x :: Int
x = 10 -- `x` is bound to 10.
f :: Integer -> Integer
f y = 2 * y
f 20 -- y is bound to 20

Local bindings are bindings local to particular expressions. The primary distinction here from top level bindings is that local bindings cannot be imported by other programs or modules.

Top level bindings in Haskell are bindings that stand outside of any other declaration. The main feature of top-level bindings is that they can be made available to other modules within your programs or to other people’s programs.