Just some from the first chapter of the online version of Learn you a Haskell.

1 Starting Out

link

  • make prompt prettier using :set prompt "ghci> "
  • 50 * -1 is an error, must do `50 * (-1)'. It seems to me that this is something to do with how whatever Haskell equivalent of operators is.
  • ok, so * is a function, whose arguments are but between it, its an infix function.
  • functions are called by writing name, space, arguments
  • parentheses are only used to group expressions into an argument.
  • an = is used to define functions.
  • :l for load to load a .hs file.
  • function names cannot begin with capital letters, the character `` is ok in a function name.
  • to define a list, use the keyword let
  • index a list usin !!
  • add to end of list with ++ add to begining with :, note that adding to end is slow.
  • ranges done using the .., i.e. [1..20]
  • tuples are defined using parentheses, however they are of fixed size but can contain mixed types.
  • list comprehensions are awesome. The | defines the predicates and domains , the <- assigns sets to a variable, and commas separate the conditions.