diff options
author | Thomas Miedema <thomasmiedema@gmail.com> | 2015-07-31 17:15:10 +0200 |
---|---|---|
committer | Thomas Miedema <thomasmiedema@gmail.com> | 2015-07-31 17:15:10 +0200 |
commit | a66e1ba60d9be67dda2a57a71bde96bc6f8dc5f0 (patch) | |
tree | d1d3dff85caa1d79aa60cfe305e9dcb46e80779d | |
parent | a442800fd27952bff9bf9773f514ee062f4b55d0 (diff) | |
download | haskell-a66e1ba60d9be67dda2a57a71bde96bc6f8dc5f0.tar.gz |
User's guide: delete ancient "Core syntax" example
-rw-r--r-- | docs/users_guide/debugging.xml | 106 |
1 files changed, 0 insertions, 106 deletions
diff --git a/docs/users_guide/debugging.xml b/docs/users_guide/debugging.xml index 4e33987dcb..fd12e1d79a 100644 --- a/docs/users_guide/debugging.xml +++ b/docs/users_guide/debugging.xml @@ -672,112 +672,6 @@ </variablelist> </sect2> - <sect2> - <title>How to read Core syntax (from some <option>-ddump</option> - flags)</title> - - <indexterm><primary>reading Core syntax</primary></indexterm> - <indexterm><primary>Core syntax, how to read</primary></indexterm> - - <para>Let's do this by commenting an example. It's from doing - <option>-ddump-ds</option> on this code: - -<programlisting> -skip2 m = m : skip2 (m+2) -</programlisting> - - Before we jump in, a word about names of things. Within GHC, - variables, type constructors, etc., are identified by their - “Uniques.” These are of the form `letter' plus - `number' (both loosely interpreted). The `letter' gives some idea - of where the Unique came from; e.g., <literal>_</literal> - means “built-in type variable”; <literal>t</literal> - means “from the typechecker”; <literal>s</literal> - means “from the simplifier”; and so on. The `number' - is printed fairly compactly in a `base-62' format, which everyone - hates except me (WDP).</para> - - <para>Remember, everything has a “Unique” and it is - usually printed out when debugging, in some form or another. So - here we go…</para> - -<programlisting> -Desugared: -Main.skip2{-r1L6-} :: _forall_ a$_4 =>{{Num a$_4}} -> a$_4 -> [a$_4] - ---# `r1L6' is the Unique for Main.skip2; ---# `_4' is the Unique for the type-variable (template) `a' ---# `{{Num a$_4}}' is a dictionary argument - -_NI_ - ---# `_NI_' means "no (pragmatic) information" yet; it will later ---# evolve into the GHC_PRAGMA info that goes into interface files. - -Main.skip2{-r1L6-} = - /\ _4 -> \ d.Num.t4Gt -> - let { - {- CoRec -} - +.t4Hg :: _4 -> _4 -> _4 - _NI_ - +.t4Hg = (+{-r3JH-} _4) d.Num.t4Gt - - fromInt.t4GS :: Int{-2i-} -> _4 - _NI_ - fromInt.t4GS = (fromInt{-r3JX-} _4) d.Num.t4Gt - ---# The `+' class method (Unique: r3JH) selects the addition code ---# from a `Num' dictionary (now an explicit lambda'd argument). ---# Because Core is 2nd-order lambda-calculus, type applications ---# and lambdas (/\) are explicit. So `+' is first applied to a ---# type (`_4'), then to a dictionary, yielding the actual addition ---# function that we will use subsequently... - ---# We play the exact same game with the (non-standard) class method ---# `fromInt'. Unsurprisingly, the type `Int' is wired into the ---# compiler. - - lit.t4Hb :: _4 - _NI_ - lit.t4Hb = - let { - ds.d4Qz :: Int{-2i-} - _NI_ - ds.d4Qz = I#! 2# - } in fromInt.t4GS ds.d4Qz - ---# `I# 2#' is just the literal Int `2'; it reflects the fact that ---# GHC defines `data Int = I# Int#', where Int# is the primitive ---# unboxed type. (see relevant info about unboxed types elsewhere...) - ---# The `!' after `I#' indicates that this is a *saturated* ---# application of the `I#' data constructor (i.e., not partially ---# applied). - - skip2.t3Ja :: _4 -> [_4] - _NI_ - skip2.t3Ja = - \ m.r1H4 -> - let { ds.d4QQ :: [_4] - _NI_ - ds.d4QQ = - let { - ds.d4QY :: _4 - _NI_ - ds.d4QY = +.t4Hg m.r1H4 lit.t4Hb - } in skip2.t3Ja ds.d4QY - } in - :! _4 m.r1H4 ds.d4QQ - - {- end CoRec -} - } in skip2.t3Ja -</programlisting> - - <para>(“It's just a simple functional language” is an - unregisterised trademark of Peyton Jones Enterprises, plc.)</para> - - </sect2> - </sect1> <!-- Emacs stuff: |