Skip to content

Description of View pattern refers to non-existing description of Pattern guards

Summary

The documentation in the GHC User Guide of View pattern (https://downloads.haskell.org/~ghc/latest/docs/html/users_guide/glasgow_exts.html#view-patterns) refers to Pattern guards:

For example, the function clunky from Pattern guards can be written using view patterns as follows

The description of Pattern guards is empty since this commit. The commit message refers to Haskell2010:

Also, since this is a Haskell 2010 feature, refer to the language report instead of explaining it.

But the language report doesn't have clunky function as an example of Pattern guards (https://www.haskell.org/onlinereport/haskell2010/haskellch3.html#x8-460003.13).

It means that the example of clunky rewritten with view patterns has no meaning since the reader can't see the original function.

Proposed improvements or changes

I can see several ways to improve current situation:

  • Put clunky back where it used to be;
  • Introduce clunky in View pattern section;
  • Replace this example with some other function (from another section of user guide or a new one);
  • Or simply delete the rewritten clunky and all references to it.
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information