Welcome to XCODX Online Compiler
Quick Start:
Ctrl+Enter Run code
Ctrl+S Save / Download
Ctrl+L Clear output
Select a language and start coding.
Welcome to XCODX Online Compiler
Quick Start:
Ctrl+Enter Run code
Ctrl+S Save / Download
Ctrl+L Clear output
Select a language and start coding.
Haskell's purity compressed into single bytes is the pitch for Husk, a functional golfing language designed in 2017 by Code Golf Stack Exchange members Leo and Zgarb. A Husk program is an expression built from combinators over a custom codepage; the language is lazy, so infinite lists are routine, and it performs its own type inference to decide how overloaded built-ins should behave for the inputs at hand. That inference is Husk's signature trick: one symbol can mean different sensible things at different types, letting programs stay short without ambiguity. The interpreter itself is written in Haskell. XCODX runs it in a real terminal with zero installation, so lazy programs that consume stdin receive whatever you type mid-execution.
"Hello, World!"
How it works: a Husk program is a function applied to its inputs, and its result is printed. A bare string literal is a constant function, so the program evaluates to the greeting and Husk outputs it directly.
Husk excels at Code Golf Stack Exchange challenges involving sequences, number theory, and anything naturally phrased as a lazy pipeline, where an infinite list plus a filter and an index beats explicit loops by many bytes. It is also one of the best languages for demonstrating type-directed overloading and laziness to students who found Haskell's syntax a barrier, since each Husk built-in is a tiny, inspectable case study in polymorphism.
Through type inference over the whole program. Each built-in carries several typed behaviors, and Husk searches for a consistent assignment that matches the declared or inferred input types, preferring earlier-listed alternatives. The result is that one codepage character can cover string, list, and numeric variants at once, which is a major source of Husk's byte savings.
Closely, in spirit and implementation. The interpreter is written in Haskell, the language is purely functional and lazy, and many built-ins mirror Prelude functions like folds, scans, and zips. But Husk is not embedded Haskell: it has its own single-byte codepage, its own inference engine tuned for golf, and implicit argument handling that no Haskell program has.
It trades a smaller built-in library for stronger composition. On list-processing and mathematical challenges Husk frequently matches or beats them because laziness and higher-order combinators fit those problems naturally. On string tasks the dictionary compression in Jelly and 05AB1E usually wins. Husk answers also tend to be unusually readable once you know the codepage, which golfers appreciate when writing explanations.
It can be a surprisingly effective teaching tool. Students put off by Haskell's syntax can watch type-directed overloading and lazy evaluation at work in Husk, where each built-in is a small, inspectable case study in polymorphism. The underlying concepts, folds, scans, laziness, and inference, are the same; only the dense codepage surface differs.
A Husk program is a single expression assembled by composing combinators over its codepage, not a sequence of statements. Typical code has no explicit loops or variable names; you wire higher-order functions together and let laziness and implicit argument handling drive the result, which is why short Husk programs can read almost like point-free Haskell.
It makes infinite lists routine. Many challenges golf shortest when you generate an unbounded sequence, filter it, and then take an element or index, letting laziness compute only what is actually needed instead of an explicit loop with a stop condition. Number-theory and sequence problems fit this lazy-pipeline style especially naturally.
main.huskplain text — no highlighter ships for this languageno standard input construct"Hello from Husk!"