FHM Playground

FHM quick reference

A program is a sequence of type and let definitions followed by one expression, whose value is the result. The program is checked and evaluated as you type. Types are inferred; annotations are optional and checked.

let id = \x -> x Definition; the type ∀ a. a → a is inferred
let id : {a} a -> a = \x -> x Annotated definition; a scopes over the body
\(n : Int) -> n + 1 Annotated lambda parameter
type Maybe a = Just a | Nothing Algebraic data type
match m with | Just x -> x | Nothing -> 0 Pattern match; must be exhaustive
let x = 1 in x + 1 Local definition
if b then 1 else 2 Conditional
1 :: [2, 3], (1, True) Lists and pairs
+ - < Built-in Int operators; chains need parentheses, as in (a + b) + c
-- …, /- … -/ Comments
--- …, /-- … -/ Doc comment for the next let, type or constructor, shown on hover

Definitions may refer to each other in any order. A recursive call at a different type (polymorphic recursion) needs a full annotation.

Keyboard

Copy link to this program
F12 Go to definition
F1 Editor command palette

The page URL always contains the current program, so the address bar is the share link. Your latest program is also kept in this browser.

Language guide · What is proved · Source