Skip to content
Halyard
Project
Source code on Codeberg (opens in new tab)

Search

Menu

Hello World

Let's write your first Halyard program!

Using the REPL

The easiest way to try Halyard is using the REPL (Read-Eval-Print Loop):

bash
halyard repl

Once in the REPL, type:

halyard
"Hello, World!"

You should see:

"Hello, World!"

Your First Function

Let's define a function that greets someone by name:

halyard
fn greet : String -> String
fn greet name =
    "Hello, " ++ name ++ "!"

greet "World"

This outputs:

"Hello, World!"

Breaking It Down

  1. fn greet : String -> String - This declares a function named greet that takes a String and returns a String
  2. fn greet name = ... - This defines the function body, where name is the parameter
  3. ++ - This is the string concatenation operator

Next Steps