Skip to content

Instantly share code, notes, and snippets.

@lymieux
Last active March 2, 2022 16:09
Show Gist options
  • Save lymieux/a89fe8f30c7d08ab9f1b6f3122e4c761 to your computer and use it in GitHub Desktop.
Save lymieux/a89fe8f30c7d08ab9f1b6f3122e4c761 to your computer and use it in GitHub Desktop.
A quick Haskell reference sheet
Non-strict, strong, static, compiled language

non-strict - lazy evaluation
strong - no variable def, like python
static - cannot change var type, like 12+"hello" not allowed

Basic Data Types:
  Number
    Dynamically typed, no need for variable ttype declaration
    Simple integer and decimal syntax e.g.
    12 or 1.5
  Character
    Accepts single quote notation e.g.
    'a'
  String
    List of characters
    Requires double quote notation
    "hello"
  Boolean
    Capitialized type
    True False
  List
    Brackets as syntax []
    Mutable and homogeneous (can change in size and same types)
    [1,2,3]
  Tuple
    Parenthesis as syntax ()
    Immutable and heterogeneous (cannot change in size and different types)
    (1,2,"three")
    
Notes:
  For char and string distiction, a string is just a list of chars
  running :type foo where foo can be a char ('c') or a string ("hello")
  will return the type, if a string is [Char] (char list)
  This can be confirmed by running
   ['a', ' ', 's', 't', 'r', 'i', 'n', 'g'] == "a string"
   which would return True
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment