summaryrefslogtreecommitdiff
path: root/libraries/template-haskell
diff options
context:
space:
mode:
authorRyan Scott <ryan.gl.scott@gmail.com>2017-09-29 23:32:41 -0400
committerBen Gamari <ben@smart-cactus.org>2017-09-30 09:30:09 -0400
commit626f0454ef1ca8f40c38064197dba97a36d52dbb (patch)
tree66bdedc950adacd4651d7f70f995e29b400a79ac /libraries/template-haskell
parent9c05fc4c31edde34a68317b45fdd71510d868f60 (diff)
downloadhaskell-626f0454ef1ca8f40c38064197dba97a36d52dbb.tar.gz
Document a law for TH's Lift class
Inspired by the discussion in #14296, I've decided to document a law which is usually in the back of my mind when I'm using Template Haskell's `Lift` class, but isn't formally stated anywhere. That is, every `Lift` instance should satisfy (for all `x`): ```lang=haskell $(lift x) == x ``` Test Plan: Read it Reviewers: austin, goldfire, bgamari Subscribers: rwbarton, thomie Differential Revision: https://phabricator.haskell.org/D4050
Diffstat (limited to 'libraries/template-haskell')
-rw-r--r--libraries/template-haskell/Language/Haskell/TH/Syntax.hs3
1 files changed, 3 insertions, 0 deletions
diff --git a/libraries/template-haskell/Language/Haskell/TH/Syntax.hs b/libraries/template-haskell/Language/Haskell/TH/Syntax.hs
index 419d94480b..0541a088bf 100644
--- a/libraries/template-haskell/Language/Haskell/TH/Syntax.hs
+++ b/libraries/template-haskell/Language/Haskell/TH/Syntax.hs
@@ -565,6 +565,9 @@ sequenceQ = sequence
-- Template Haskell has no way of knowing what value @x@ will take on at
-- splice-time, so it requires the type of @x@ to be an instance of 'Lift'.
--
+-- A 'Lift' instance must satisfy @$(lift x) ≡ x@ for all @x@, where @$(...)@
+-- is a Template Haskell splice.
+--
-- 'Lift' instances can be derived automatically by use of the @-XDeriveLift@
-- GHC language extension:
--