Change a comment referring falsely to seq
ClosedPublic

Authored by dfeuer on Nov 6 2014, 2:15 AM.

Diff Detail

Repository
rGHC Glasgow Haskell Compiler
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.
dfeuer updated this revision to Diff 1294.Nov 6 2014, 2:15 AM
dfeuer retitled this revision from to Change a comment referring falsely to seq.
dfeuer updated this object.
dfeuer edited the test plan for this revision. (Show Details)
dfeuer added a reviewer: hvr.
hvr added a subscriber: simonpj.

@simonpj, I wanted to get your opinion on this one as I'm on the fence on whether it's sensible *not* to refer to seq in the documentation of $! (partly also because the Haskell Report explicitly defines $! in terms of seq)

dfeuer added a comment.Nov 6 2014, 3:05 AM
In D448#10943, @hvr wrote:

@simonpj, I wanted to get your opinion on this one as I'm on the fence on whether it's sensible *not* to refer to seq in the documentation of $! (partly also because the Haskell Report explicitly defines $! in terms of seq)

I think one of the most magical thing about Haddocks is that anyone can click through and see what the source code really says—this makes lies told to children rather more confusing.

simonpj edited edge metadata.Nov 6 2014, 3:54 AM

I think it'd be better to describe the behaviour rather than the implementation.

How about "Strict (call-by-value) application. Guarantees to evaluate the argument, and then call the function passing the evaluated argument."

hvr added a comment.Nov 6 2014, 5:45 AM

@simonpj I like the idea of rather describing the behaviour/semantics rather than specific concrete implementation (which as @dfeuer points out can be looked at via Haddock's source-link)

PS: For reference: Section 6.2 Strict Evaluation from the Haskell Report which defines $!

dfeuer added a comment.Nov 6 2014, 8:01 AM
In D448#10956, @simonpj wrote:

I think it'd be better to describe the behaviour rather than the implementation.

How about "Strict (call-by-value) application. Guarantees to evaluate the argument, and then call the function passing the evaluated argument."

I can definitely get behind this idea, but let's be careful to specify WHNF.

ekmett accepted this revision.Nov 7 2014, 10:01 AM
ekmett edited edge metadata.

Defining it in terms of behavior makes a lot of sense to me, too.

hvr added a comment.Nov 7 2014, 11:10 AM
In D448#10977, @dfeuer wrote:

I can definitely get behind this idea, but let's be careful to specify WHNF.

If we add a mention of WHNF (a term which the Haskell Report seems to avoid in the definition of seq et al.) then maybe GHC's seq's documentation would need to be modified as well to mention WHNF.

austin accepted this revision.Nov 7 2014, 1:17 PM
austin edited edge metadata.

LGTM.

This revision is now accepted and ready to land.Nov 7 2014, 1:17 PM
dfeuer updated this revision to Diff 1337.Nov 8 2014, 12:34 AM
dfeuer edited edge metadata.

Modify description to reflect discussion.

dfeuer updated this object.Nov 8 2014, 1:07 PM
dfeuer edited the test plan for this revision. (Show Details)
dfeuer added a project: GHC.
This revision was automatically updated to reflect the committed changes.