Lesson 03 of 55
9 mins readPython Basic Types & Immutability
In Plain English
Haskell features standard primitive types: fixed-size Int, unbounded Integer, Float, Double, Bool (True, False), Char ('a'), and String (which is an alias for [Char]).
Deep Dive: How It Works
Int vs Integer: Int is machine-word sized (e.g. 64-bit); Integer is unbounded arbitrary-precision (no integer overflow).
Float & Double: Single and double-precision IEEE 754 floating point numbers.
Char & String: Char represents Unicode code points; String is represented as a linked list of characters [Char].
Immutability: Once bound, a name identifier cannot be modified.
Core Rules to Remember

Int vs Arbitrary Precision Integer: Integer can hold arbitrarily large numbers (e.g. 2^1000) without overflow.

String is [Char]: All list operations work seamlessly on strings.
Live Interactive Example
Hit Run Code to see it liveInspecting Types and Values
Python 3.12
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
Output Console
Click "Run Code" to view the rendered output.
How it works: show converts any Show-compatible type to a String representation.
Your Turn: Micro Challenge
No pressure! Edit the starter code below and test your solution with instant feedback.
Micro Exercise
Compute Large Integer Power
Calculate `2 ^ 50` and print `"Power: "` concatenated with its `show` string.
1
2
3
4
5
6
Sandbox Output
Click "Run & Check" to test your solution.
Finished reading and practicing?
Mark this lesson as completed to update your course progress.