haskell also teaches you another important lesson: most of your program can be pure functions that do not mutate anything, they purely transform data from input A to output B. A program is simply a machine that is mapping and reducing data over some time.

For side effects, like reading from db/files or writing to a socket, you can do this in a small impure layer at the top your program. This layer just builds values so that they can be passed through the pure machinery.

The pure code can’t really crash due to total pattern matching, so it is nice for super robust programs.

Reply to this note

Please Login to reply.

Discussion

No replies yet.