HexLibraryHexLibrary
</> HexCodeSign inSign up
PythonJavaScriptTypeScriptCC++JavaPHPGoRustRubyBashSQLLuaPerlCOBOLPascalDelphiFortranDartSwiftC#JuliaGroovyRElixirHaskellKotlinScalaClassic ASPClipperMS-DOS
LESSONS
Introduction to HaskellVariables (let)Data TypesOperatorsStringsListsConditions (if / then / else)Iteration (map / sum)Functions
REFERENCE
📖 Overview
🖥️ Output
📦 Value & Type
🔢 Numbers & Math
✍️ String
📚 List
🔀 Condition
🧩 Function
Function definitionLambda ( \ )
Haskell›REFERENCE›Function›Function definition

Function definition

Defining your own function.

Syntax

name :: Type -> Type\nname param = expression

Description

Functions are written as 'name parameter = expression'; a type signature (::) is placed above. Calls are without parentheses, and arguments are separated by spaces.

Example

Loading editor…

Expected output

17

When to use?

Preventing code repetition, breaking the program into parts.

Common mistakes

  • ⚠️ Calls are without parentheses: addUp 8 9 (not addUp(8,9)).

Related commands

Lambda ( \ )
Lambda ( \ ) →
HexLibraryHexLibrary

Learn programming more clearly. Every command is explained line by line with colors, reinforced with runnable exercises, test your code instantly — all in one place, free.

Learn

  • Home
  • Languages & Lessons
  • HexCode

Company

  • About
  • Contact

Legal

  • Privacy Policy
  • Terms of Use

Other Projects

  • HexToolz
  • Free Service Manuals
© 2026 HexLibrary · The clearest way to learn code