Java vs Haskell

Starting Java

Haskell

  • pure = no side effects for any function
  • lazy = we did not encounter this
  • functional = functions can be inputs to other functions
  • lots of cool syntax like [1..10] or [x^2 | x <- [1..9]]
  • types were optional (deduced)
  • indentation made one thing go inside another (where)
  • the last line of a function is returned the function output value
  • syntax can be over the top ()-() could be a function?!
  • very crap error messages

Java

  • side effects are the way everything is done (objects change state)
  • imperative (say how to do it, not just what to do)
  • not using functions as inputs to other functions (changed in Java 8+)
  • no cool syntax
  • lots of syntax and special “reserved” words
  • types are required
  • braces { ... } to put things inside each other
  • output values must be specified using a return statement
  • semicolons to end each “line” = statement or group of statements
  • consistency is weird sometimes (I will point this out)
  • need to understand how the computer sees “memory”
  • crap error messages

Resources

Last modified August 18, 2023: 2022-2023 End State (7352e87)