Are there any statically-typed functional languages?

ericsoco picture ericsoco · Nov 16, 2011 · Viewed 9.5k times · Source

I'm coming from a statically-typed background and investigating functional programming, but I'm not entirely excited about dynamic typing. I'm curious about what kind of options are out there.

One answer to start: ActionScript 3 is statically-typed and offers some functional paradigms, though AS3 programs don't often use them.

Answer

Frank picture Frank · Nov 16, 2011

There are many. Haskell, OCaml and F# come to mind. If you are a Windows developer, F# is very nice and is well supported by Microsoft (along with a very strong StackOverflow community). Lisp family languages (Common Lisp, Scheme, Clojure) are examples of dynamic functional languages.

ActionScript 3 has optional static typing. The Haskell, OCaml and F# compilers, on the other hand, use type inference to deterministically infer types. When you first look at code written in OCaml the absence of explicit types gives it the clutter free look of a dynamically typed language with the type safety of static typing. It is my opinion that optional static typing for dynamic languages (a great idea) will eventually be replaced by type inference and that 10 years from now the static versus dynamic debate will be moot.