Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
875 views
in Technique[技术] by (71.8m points)

haskell - What part of Hindley-Milner do you not understand?

I swear there used to be a T-shirt for sale featuring the immortal words:


What part of

Hindley-Milner

do you not understand?


In my case, the answer would be... all of it!

In particular, I often see notation like this in Haskell papers, but I have no clue what any of it means. I have no idea what branch of mathematics it's supposed to be.

I recognize the letters of the Greek alphabet of course and symbols such as "?" (which usually means that something is not an element of a set).

On the other hand, I've never seen "?" before (Wikipedia claims it might mean "partition"). I'm also unfamiliar with the use of the vinculum here. (Usually, it denotes a fraction, but that does not appear to be the case here.)

If somebody could at least tell me where to start looking to comprehend what this sea of symbols means, that would be helpful.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)
  • The horizontal bar means that "[above] implies [below]".
  • If there are multiple expressions in [above], then consider them anded together; all of the [above] must be true in order to guarantee the [below].
  • : means has type
  • means is in. (Likewise ? means "is not in".)
  • Γ is usually used to refer to an environment or context; in this case it can be thought of as a set of type annotations, pairing an identifier with its type. Therefore x : σ ∈ Γ means that the environment Γ includes the fact that x has type σ.
  • ? can be read as proves or determines. Γ ? x : σ means that the environment Γ determines that x has type σ.
  • , is a way of including specific additional assumptions into an environment Γ.
    Therefore, Γ, x : τ ? e : τ' means that environment Γ, with the additional, overriding assumption that x has type τ, proves that e has type τ'.

As requested: operator precedence, from highest to lowest:

  • Language-specific infix and mixfix operators, such as λ x . e, ? α . σ, and τ → τ', let x = e0 in e1, and whitespace for function application.
  • :
  • and ?
  • , (left-associative)
  • ?
  • whitespace separating multiple propositions (associative)
  • the horizontal bar

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

1.4m articles

1.4m replys

5 comments

57.0k users

...