forked from orion/obsidian
update
This commit is contained in:
13
fp/Terminology/Referential Transparency.md
Normal file
13
fp/Terminology/Referential Transparency.md
Normal file
@@ -0,0 +1,13 @@
|
||||
A property of [[Purity|pure]] [[Functions|functions]] that they can always be replaced by the expression they return.
|
||||
|
||||
For example `add` is referentially transparent, so
|
||||
```haskell
|
||||
a = add 1 3
|
||||
```
|
||||
|
||||
could be replaced with
|
||||
```haskell
|
||||
a = 4
|
||||
```
|
||||
|
||||
at design- or compile-time, because `add` always returns the same result and performs no observable side-effects.
|
||||
Reference in New Issue
Block a user