diff options
author | Simon Peyton Jones <simonpj@microsoft.com> | 2016-01-26 09:24:33 +0000 |
---|---|---|
committer | Simon Peyton Jones <simonpj@microsoft.com> | 2016-01-26 09:48:20 +0000 |
commit | 47b3f58889caa71bf096a149e58c2a9b94b75a7d (patch) | |
tree | 0e95f7c7719c2d73dc7257dc312568a91a0c6f8b /testsuite/tests | |
parent | cf788a53df3ada686ec516c2edffeb54b632065f (diff) | |
download | haskell-47b3f58889caa71bf096a149e58c2a9b94b75a7d.tar.gz |
Add "ticks-exhausted" comment
This code deliberately builds a subtle negative-occurrence-of-data-type
example, described in the paper, so with -O it'll give "simplifier
ticks exhausted".
This patch just adds a comment to explain.
Diffstat (limited to 'testsuite/tests')
-rw-r--r-- | testsuite/tests/dependent/should_compile/dynamic-paper.hs | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/testsuite/tests/dependent/should_compile/dynamic-paper.hs b/testsuite/tests/dependent/should_compile/dynamic-paper.hs index 4e892099b2..fd638713be 100644 --- a/testsuite/tests/dependent/should_compile/dynamic-paper.hs +++ b/testsuite/tests/dependent/should_compile/dynamic-paper.hs @@ -1,6 +1,9 @@ {- This is the code extracted from "A reflection on types", by Simon PJ, Stephanie Weirich, Richard Eisenberg, and Dimitrios Vytiniotis, 2016. -} +-- NB: it includes a negative-recursive function (see delta1), and +-- so will give "simplifer ticks exhausted", at least with -O + {-# LANGUAGE RankNTypes, PolyKinds, TypeOperators, ScopedTypeVariables, GADTs, FlexibleInstances, UndecidableInstances, RebindableSyntax, @@ -239,6 +242,10 @@ tcMaybe = TyCon { tc_module = Module { mod_pkg = "base" rt = undefined delta1 :: Dynamic -> Dynamic +-- NB: this function behaves like a negative-recursive data type +-- and hence leads compiler into an infinite inlining loop, +-- and we get "simplifier ticks exhausted". +-- See Section 7 of the paper "A reflection on types" delta1 dn = case fromDynamic dn of Just f -> f dn Nothing -> dn |