8

What does the period / dot mean?

forall a. Num a => a -> a -> a

Is it merely a separator?

M. Walker
  • 603
  • 4
  • 14

1 Answers1

15

Yes, it's just a syntactic separator. It separates variable declarations from variable usages, just like the -> in a lambda expression. It means "Here endeth the binders". I suppose the language designers went for . because it's 22 characters shorter.

Benjamin Hodgson
  • 42,952
  • 15
  • 108
  • 157
  • 3
    The other usual notations in mathematics are rather annoying for programming: `forall a (Num a => a -> a -> a)` and `forall a : Num a => a -> a -> a`. This leaves us with `.`. –  Sep 10 '17 at 00:06
  • @rightfold `:` wouldn't have been that bad, I suppose – Benjamin Hodgson Sep 10 '17 at 00:10
  • 4
    @M.Walker Many mathematicians do as well. The problem is that, in type theory, programming languages theory (and category theory to some extent), we write a lot of "forall x:T, y:A->B, ...". Writing "forall x:T: p(x)" looks strange. Historically a trend formed to write "forall x:T. p(x)", perhaps borrowing the "dot" separator from lambda calculus. (I don't know who started that, though -- Peano/Russell used dots, but differently.) Haskell followed that trend (but without commas). In CS papers, I often see dots, but other notations are used as well. – chi Sep 10 '17 at 08:09