<p>This response assumes you know what Types are.</p>
<p>Type safety is pretty much ensuring that you’re putting square pegs into square holes at all times to avoid buggy code.</p>
<p>Example:</p>
<p>A) 3 * 1 -&gt; This is correct because both are integers (Int) and operation can be done.</p>
<p>B) 3 * “foo” —&gt; This is wrong because one is an integer (Int) whereas the other is a string ([Char]), the operation can’t be done.</p>
<p>Expression A is type safe whereas Expression B isn’t.</p>

CC BY-SA 4.0
2022-07-11T08:02:14.650Z
2022-07-11T08:02:14.650Z
Pizza Knight
<p>In the Haskell programming language there are a number of concepts that must be understood by anyone wishing to learn and use the maximum potential of the language. One of these what is is type safety.</p>
<p>My question is what is meant by type safety?</p>

CC BY-SA 4.0
2022-07-03T21:49:43.130Z
Wikipedia has better explanation that I could give : https://en.wikipedia.org/wiki/Type_safety
Erik de Castro Lopo
<plutus><haskell>
What is Type Safety?
# What is Type Safety?

(Asked by: username_0 on 2022-07-02)

In the Haskell programming language there are a number of concepts that must be understood by anyone wishing to learn and use the maximum potential of the language. One of these what is is type safety.

My question is what is meant by type safety?

**Tags:** plutus, haskell
> **Comments:**
> **username_1**: Wikipedia has better explanation that I could give : https://en.wikipedia.org/wiki/Type_safety  

---

## 1 answers

### Answer by username_2 on 2022-07-11. Score: 0

This response assumes you know what Types are.

Type safety is pretty much ensuring that you’re putting square pegs into square holes at all times to avoid buggy code.

Example:

A) 3 \* 1 -> This is correct because both are integers (Int) and operation can be done.

B) 3 \* “foo” —> This is wrong because one is an integer (Int) whereas the other is a string ([Char]), the operation can’t be done.

Expression A is type safe whereas Expression B isn’t.


---

