Generic Functions
Generic functions use type parameters such as a.
fn first(items: List(a)) -> a:
case items:
[head, .._] -> head
The same function can work with different element types.
let name = first(["Donna", "QBE"])
let number = first([1, 2, 3])
Generics are most useful for containers and small helpers.
fn identity(value: a) -> a:
value
If the function needs behavior specific to a type, write the concrete function. Generics should reduce duplication, not hide intent.