this post was submitted on 05 Feb 2024
23 points (96.0% liked)

Programming

17424 readers
45 users here now

Welcome to the main community in programming.dev! Feel free to post anything relating to programming here!

Cross posting is strongly encouraged in the instance. If you feel your post or another person's post makes sense in another community cross post into it.

Hope you enjoy the instance!

Rules

Rules

  • Follow the programming.dev instance rules
  • Keep content related to programming in some way
  • If you're posting long videos try to add in some form of tldr for those who don't want to watch videos

Wormhole

Follow the wormhole through a path of communities !webdev@programming.dev



founded 1 year ago
MODERATORS
 

cross-posted from: https://lemy.lol/post/19181146

I just started to learn Ocaml to learn functional programming. I will use it to build a CLI that's mostly orchestrating other programs.

My experience is mostly in JS / TS, but I've also coded a good bit in Python and Lua.

Below, I provided a list of things I learned or focused on while using OCaml. But I feel like I must be missing something. This is only moderately different from what I'm used to in JS. I expected something more radical. Moreover, I constantly hear a lot of FP jargon (like "highly kinded types", monads, etc) that I feel am still missing.

So far, here's what I studied:

  • immutability
  • avoid side affects
  • static typing
  • recursion instead of loops
  • option / maybe
  • higher order functions
  • conditionals and other constructs as expressions, when they're statements in other languages
  • pipelines and functions as input —> output
  • currying
  • scoping with let

What am I missing?

you are viewing a single comment's thread
view the rest of the comments
[–] matcha_addict@lemy.lol 3 points 9 months ago (1 children)

My fear with Haskell is that I will end up trying to learn category theory, which will be a much bigger time sink. But I suppose it is the natural next step.

Thanks for the pointer on the module system! I'll study that next.

[–] solrize@lemmy.world 3 points 9 months ago

CT as used in Haskell isn't a big deal. I found that it demystified a lot so was worth looking into, but really, it's optional. This tutorial is good:

https://en.wikibooks.org/wiki/Haskell/Category_theory

Even more optional, after the above try this:

https://www.haskellforall.com/2012/08/the-category-design-pattern.html