An introduction to the Hare standard library

This tutorial introduces you to the Hare standard library. It assumes familiarity with most of the fundamental language concepts, which you can learn from the language introduction tutorial. You are also encouraged to make liberal use of the standard library’s reference documentation, which is available in your terminal via the “haredoc” tool, or available online at

We will not cover the entire standard library in this tutorial, but we will introduce you to the most important parts of the standard library, and give you an idea of its general design and use.

Note: As you can tell, much of this tutorial remains to be written! However, comprehensive reference documentation is available for the standard library. You can browse it in your terminal via the "haredoc" command, or online at If you have any questions, do not hestitate to connect with the Hare community.

Input and output

Hare’s I/O abstraction

Hare’s filesystem abstraction

Host I/O primitives

Host filesystem primitives

Buffered I/O

I/O multiplexing

Custom I/O interfaces

Working with strings

Formatting text

String manipulation

Converting to and from strings

Efficient string I/O

base64, base32, and hex

More filesystem utilities

Using user directories

Using temporary files and directories

Working with paths

Handling command line arguments


Executing other programs

os::exec basics

Waiting on children

Setting environment variables

Pipes and file descriptors

Sorted slices

Sorting a slice

Working with sorted slices

Regular expressions

Working with POSIX ERE


IP addresses

TCP and Unix sockets

UDP support


Date and time

Basic timekeeping

Working with time zones and chronologies


Formatting and parsing


Encrypting and decrypting data

Signing and validation

Key derivation

Low-level cryptographic primitives