Search notes:

Haskell

-- Comments are introduces with two hyphens (much like in SQL)
"abc" is syntactic sugar for 'a': 'b': 'c': []
a:b:c:d is shorthand for a:b:(c:d)

Pattern matching

Values are pattern matched («deconstructed») by writing however they were constructed.
let (x, y, z) = (42, 99, 7) in …
let (char1:char_2:char3:[]) = "abc" in …
-- Use underscore for 'throw away' values:
let (first_char:_:_:[]) = "abc" in first_char

See also

Other programming languages etc.

Index