How Do You Read Types?

This is a fun question!

I find when things get complicated, I try to use different sentence patterns for the same concepts to help distinguish between different levels of nesting. And I tend to repeat small chunks to myself and then build up larger chunks. So in your examples, I might think:

(<|) : (a → b) → a → b

  • okay, we’ve got a function
  • the first argument is another function that converts a to b
  • the second argument is an a
  • and it returns a b

(|>) : a → (a → b) → b

  • okay, we’ve got an a
  • and we’ve got a function that converts a's to b's
  • and it returns a b

(I guess I like to hype myself up by starting with “okay” :slight_smile: )

With those specific examples, I’m familiar enough with them that I wouldn’t normally think all that, but when I see functions that start to confuse me, that’s the type of self-talk I tend to fall back on.

5 Likes