Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

primops.txt.pp: add missing type application in description of GHC.Pr…

…im.Any

Understanding GHC.Prim.Any is all about understanding the need for
explicit type applications in CoreSyn; the previous example had one
explicit type application but was missing the other, which this patch
adds.  It also expands the explanation, based on SPJ's post here:

  http://article.gmane.org/gmane.comp.lang.haskell.cvs.ghc/46551
  • Loading branch information...
commit e11c554e94c39223ea55991a552ccb244dfe4364 1 parent 51bbdda
megacz megacz authored igfoo committed

Showing 1 changed file with 12 additions and 2 deletions. Show diff stats Hide diff stats

  1. +12 2 compiler/prelude/primops.txt.pp
14 compiler/prelude/primops.txt.pp
@@ -1738,9 +1738,19 @@
1738 1738 but never enters a function value.
1739 1739
1740 1740 It's also used to instantiate un-constrained type variables after type
1741   - checking. For example
  1741 + checking. For example, {\tt length} has type
1742 1742
1743   - {\tt length Any []}
  1743 + {\tt length :: forall a. [a] -> Int}
  1744 +
  1745 + and the list datacon for the empty list has type
  1746 +
  1747 + {\tt [] :: forall a. [a]}
  1748 +
  1749 + In order to compose these two terms as {\tt length []} a type
  1750 + application is required, but there is no constraint on the
  1751 + choice. In this situation GHC uses {\tt Any}:
  1752 +
  1753 + {\tt length Any ([] Any)}
1744 1754
1745 1755 Annoyingly, we sometimes need {\tt Any}s of other kinds, such as {\tt (* -> *)} etc.
1746 1756 This is a bit like tuples. We define a couple of useful ones here,

0 comments on commit e11c554

Please sign in to comment.
Something went wrong with that request. Please try again.