this post was submitted on 19 Jun 2023
5 points (100.0% liked)

Functional Programming

1389 readers
1 users here now

founded 1 year ago
MODERATORS
 

My first language was Racket and so naturally I gravitated to the lispy untyped functional programming style even when I was using languages like Python or Java, but when I tried Haskell for the first time my mind was absolutely blown and I was a convert ever since. What are your thoughts?

you are viewing a single comment's thread
view the rest of the comments
[โ€“] em7@programming.dev 1 points 1 year ago (1 children)

If the language has really good type inference (Haskell comes to my mind though F# was quite nice as well) it's better. It really makes life much easier.

However when dealing with real-world problems (just moving data around which are changing constantly) the types don't really add that much, you need to test anyway. Test suites is what I need. Clojure and Common Lisp are OK.

[โ€“] mzan@programming.dev 1 points 1 year ago

I agree. F# has also type providers (https://learn.microsoft.com/en-us/dotnet/fsharp/tutorials/type-providers/) that are a form of type-inference on steroids, for assigning types to external resources.

IMHO, whenever possible it is better using static typing, but there are real world problems where the nature of data is extremely dynamic, or the types are very complex. In these cases a naive but rigid static type system can be a problem. So in these cases it is better or a relaxed static type system where some constraints can be checked at run-time (i.e. like a dynamic type-system), or a very powerful static type system. In a certain sense, Common Lisp and Racket are examples of the first case, because you can add type annotations to code, so they are both dynamically and statically typed language.