diff options
Diffstat (limited to 'hypsrc-test')
-rw-r--r-- | hypsrc-test/ref/src/TemplateHaskellQuasiquotes.html | 372 | ||||
-rw-r--r-- | hypsrc-test/ref/src/TemplateHaskellSplices.html | 114 | ||||
-rw-r--r-- | hypsrc-test/src/TemplateHaskellQuasiquotes.hs | 6 | ||||
-rw-r--r-- | hypsrc-test/src/TemplateHaskellSplices.hs | 4 |
4 files changed, 447 insertions, 49 deletions
diff --git a/hypsrc-test/ref/src/TemplateHaskellQuasiquotes.html b/hypsrc-test/ref/src/TemplateHaskellQuasiquotes.html index 9c06e8e0..afa30574 100644 --- a/hypsrc-test/ref/src/TemplateHaskellQuasiquotes.html +++ b/hypsrc-test/ref/src/TemplateHaskellQuasiquotes.html @@ -110,8 +110,12 @@ ></span ><span > </span - ><span class="hs-identifier" - >bar</span + ><span class="annot" + ><a href="#" + ><span class="hs-identifier hs-type" + >bar</span + ></a + ></span ><span > </span ><span class="hs-glyph" @@ -120,8 +124,15 @@ > </span ><span class="hs-special" >$</span - ><span class="hs-identifier" - >aType</span + ><span class="annot" + ><span class="annottext" + >TypeQ +</span + ><a href="TemplateHaskellQuasiquotes.html#aType" + ><span class="hs-identifier hs-var" + >aType</span + ></a + ></span ><span > </span ><span class="hs-glyph" @@ -134,14 +145,18 @@ > </span ><span class="hs-special" >(</span - ><span class="hs-identifier" - >Int</span + ><span class="annot" + ><span class="hs-identifier hs-type" + >Int</span + ></span ><span class="hs-special" >,</span ><span > </span - ><span class="hs-identifier" - >String</span + ><span class="annot" + ><span class="hs-identifier hs-type" + >String</span + ></span ><span class="hs-special" >)</span ><span @@ -155,14 +170,27 @@ ></span ><span > </span - ><span class="hs-identifier" - >bar</span + ><span id="" + ><span class="annot" + ><a href="#" + ><span class="hs-identifier hs-var hs-var" + >bar</span + ></a + ></span + ></span ><span > </span ><span class="hs-special" >$</span - ><span class="hs-identifier" - >aPattern</span + ><span class="annot" + ><span class="annottext" + >PatQ +</span + ><a href="TemplateHaskellQuasiquotes.html#aPattern" + ><span class="hs-identifier hs-var" + >aPattern</span + ></a + ></span ><span > </span ><span class="hs-glyph" @@ -171,8 +199,15 @@ > </span ><span class="hs-special" >$</span - ><span class="hs-identifier" - >anExpression</span + ><span class="annot" + ><span class="annottext" + >ExpQ +</span + ><a href="TemplateHaskellQuasiquotes.html#anExpression" + ><span class="hs-identifier hs-var" + >anExpression</span + ></a + ></span ><span > </span @@ -243,8 +278,14 @@ >[</span ><span > </span - ><span class="hs-identifier" - >aCrazyLongVariableName</span + ><span id="" + ><span class="annot" + ><a href="#" + ><span class="hs-identifier hs-var" + >aCrazyLongVariableName</span + ></a + ></span + ></span ><span > </span @@ -256,8 +297,14 @@ >,</span ><span > </span - ><span class="hs-identifier" - >_unused</span + ><span id="" + ><span class="annot" + ><a href="#" + ><span class="hs-identifier hs-var" + >_unused</span + ></a + ></span + ></span ><span > </span @@ -271,14 +318,26 @@ > </span ><span class="hs-special" >(</span - ><span class="hs-identifier" - >y</span + ><span id="" + ><span class="annot" + ><a href="#" + ><span class="hs-identifier hs-var" + >y</span + ></a + ></span + ></span ><span class="hs-special" >,</span ><span > </span - ><span class="hs-identifier" - >z</span + ><span id="" + ><span class="annot" + ><a href="#" + ><span class="hs-identifier hs-var" + >z</span + ></a + ></span + ></span ><span class="hs-special" >)</span ><span @@ -298,14 +357,23 @@ > </span ><span class="hs-special" >$</span - ><span class="hs-identifier" - >aNumberPattern</span + ><span class="annot" + ><span class="annottext" + >PatQ +</span + ><a href="TemplateHaskellQuasiquotes.html#aNumberPattern" + ><span class="hs-identifier hs-var" + >aNumberPattern</span + ></a + ></span ><span class="hs-special" >,</span ><span > </span + ><span class="annot" ><span class="hs-string" - >"hello"</span + >"hello"</span + ></span ><span class="hs-special" >)</span ><span @@ -383,16 +451,30 @@ ></span ><span > </span - ><span class="hs-identifier" - >w</span + ><span id="" + ><span class="annot" + ><a href="#" + ><span class="hs-identifier hs-var" + >w</span + ></a + ></span + ></span ><span class="hs-glyph" >@</span - ><span class="hs-identifier" - >v</span + ><span id="" + ><span class="annot" + ><a href="#" + ><span class="hs-identifier hs-var" + >v</span + ></a + ></span + ></span ><span class="hs-glyph" >@</span + ><span class="annot" ><span class="hs-number" - >4.5</span + >4.5</span + ></span ><span > </span @@ -475,24 +557,37 @@ > </span ><span class="hs-special" >(</span + ><span class="annot" ><span class="hs-number" - >1</span + >1</span + ></span ><span > </span - ><span class="hs-operator" - >+</span + ><span class="annot" + ><span class="hs-operator hs-type" + >+</span + ></span ><span > </span ><span class="hs-special" >$</span - ><span class="hs-identifier" - >anExpression2</span + ><span class="annot" + ><span class="annottext" + >ExpQ +</span + ><a href="TemplateHaskellQuasiquotes.html#anExpression2" + ><span class="hs-identifier hs-var" + >anExpression2</span + ></a + ></span ><span class="hs-special" >,</span ><span > </span + ><span class="annot" ><span class="hs-string" - >"world"</span + >"world"</span + ></span ><span class="hs-special" >)</span ><span @@ -536,20 +631,28 @@ > </span ><span class="hs-special" >(</span + ><span class="annot" ><span class="hs-number" - >1</span + >1</span + ></span ><span > </span - ><span class="hs-operator" - >+</span + ><span class="annot" + ><span class="hs-operator hs-type" + >+</span + ></span ><span > </span - ><span class="hs-identifier" - >round</span + ><span class="annot" + ><span class="hs-identifier hs-type" + >round</span + ></span ><span > </span - ><span class="hs-identifier" - >pi</span + ><span class="annot" + ><span class="hs-identifier hs-type" + >pi</span + ></span ><span class="hs-special" >)</span ><span @@ -619,14 +722,18 @@ > </span ><span class="hs-special" >(</span - ><span class="hs-identifier" - >Double</span + ><span class="annot" + ><span class="hs-identifier hs-type" + >Double</span + ></span ><span class="hs-special" >,</span ><span > </span - ><span class="hs-identifier" - >String</span + ><span class="annot" + ><span class="hs-identifier hs-type" + >String</span + ></span ><span class="hs-special" >)</span ><span @@ -652,16 +759,187 @@ </span ><span id="line-39" ></span + ><span class="annot" + ><a href="TemplateHaskellQuasiquotes.html#typedExpr1" + ><span class="hs-identifier hs-type" + >typedExpr1</span + ></a + ></span + ><span + > </span + ><span class="hs-glyph" + >::</span + ><span + > </span + ><span class="annot" + ><span class="hs-identifier hs-type" + >Code</span + ></span + ><span + > </span + ><span class="annot" + ><span class="hs-identifier hs-type" + >Q</span + ></span + ><span + > </span + ><span class="hs-special" + >(</span + ><span class="hs-special" + >)</span ><span > </span ><span id="line-40" ></span + ><span id="typedExpr1" + ><span class="annot" + ><span class="annottext" + >typedExpr1 :: Code Q () +</span + ><a href="TemplateHaskellQuasiquotes.html#typedExpr1" + ><span class="hs-identifier hs-var hs-var" + >typedExpr1</span + ></a + ></span + ></span + ><span + > </span + ><span class="hs-glyph" + >=</span + ><span + > </span + ><span class="hs-special" + >[||</span + ><span + > </span + ><span class="hs-special" + >(</span + ><span class="hs-special" + >)</span + ><span + > </span + ><span class="hs-special" + >||]</span ><span > </span ><span id="line-41" ></span + ><span + > +</span + ><span id="line-42" + ></span + ><span class="annot" + ><a href="TemplateHaskellQuasiquotes.html#typedExpr" + ><span class="hs-identifier hs-type" + >typedExpr</span + ></a + ></span + ><span + > </span + ><span class="hs-glyph" + >::</span + ><span + > </span + ><span class="annot" + ><span class="hs-identifier hs-type" + >Code</span + ></span + ><span + > </span + ><span class="annot" + ><span class="hs-identifier hs-type" + >Q</span + ></span + ><span + > </span + ><span class="hs-special" + >(</span + ><span class="hs-special" + >)</span + ><span + > +</span + ><span id="line-43" + ></span + ><span id="typedExpr" + ><span class="annot" + ><span class="annottext" + >typedExpr :: Code Q () +</span + ><a href="TemplateHaskellQuasiquotes.html#typedExpr" + ><span class="hs-identifier hs-var hs-var" + >typedExpr</span + ></a + ></span + ></span + ><span + > </span + ><span class="hs-glyph" + >=</span + ><span + > </span + ><span class="hs-special" + >[||</span + ><span + > </span + ><span class="annot" + ><span class="annottext" + >a -> b -> a +forall a b. a -> b -> a +</span + ><span class="hs-identifier hs-var" + >const</span + ></span + ><span + > </span + ><span class="hs-special" + >$$</span + ><span class="hs-special" + >(</span + ><span class="annot" + ><span class="annottext" + >Code Q () +</span + ><a href="TemplateHaskellQuasiquotes.html#typedExpr1" + ><span class="hs-identifier hs-var" + >typedExpr1</span + ></a + ></span + ><span class="hs-special" + >)</span + ><span + > </span + ><span class="hs-special" + >(</span + ><span class="hs-special" + >)</span + ><span + > </span + ><span class="hs-special" + >||]</span + ><span + > +</span + ><span id="line-44" + ></span + ><span + > +</span + ><span id="line-45" + ></span + ><span + > +</span + ><span id="line-46" + ></span + ><span + > +</span + ><span id="line-47" + ></span ></pre ></body ></html diff --git a/hypsrc-test/ref/src/TemplateHaskellSplices.html b/hypsrc-test/ref/src/TemplateHaskellSplices.html index db43c818..bb31fb76 100644 --- a/hypsrc-test/ref/src/TemplateHaskellSplices.html +++ b/hypsrc-test/ref/src/TemplateHaskellSplices.html @@ -111,8 +111,12 @@ forall a. a -> a >$</span ><span class="hs-special" >(</span - ><span class="hs-identifier" - >anExpression2</span + ><span class="annot" + ><a href="TemplateHaskellQuasiquotes.html#anExpression2" + ><span class="hs-identifier hs-type" + >anExpression2</span + ></a + ></span ><span class="hs-special" >)</span ><span @@ -120,6 +124,112 @@ forall a. a -> a </span ><span id="line-10" ></span + ><span + > +</span + ><span id="line-11" + ></span + ><span id="pat" + ><span class="annot" + ><span class="annottext" + >pat :: [(a, String)] -> () +</span + ><a href="TemplateHaskellSplices.html#pat" + ><span class="hs-identifier hs-var hs-var" + >pat</span + ></a + ></span + ></span + ><span + > </span + ><span class="hs-special" + >$</span + ><span id="" + ><span id="" + ><span id="" + ><span id="" + ><span id="" + ><span id="" + ><span class="hs-special" + >(</span + ><span class="annot" + ><a href="TemplateHaskellQuasiquotes.html#aPattern" + ><span class="hs-identifier hs-type" + >aPattern</span + ></a + ></span + ><span class="hs-special" + >)</span + ></span + ></span + ></span + ></span + ></span + ></span + ><span + > </span + ><span class="hs-glyph" + >=</span + ><span + > </span + ><span class="hs-special" + >(</span + ><span class="hs-special" + >)</span + ><span + > +</span + ><span id="line-12" + ></span + ><span + > +</span + ><span id="line-13" + ></span + ><span id="qux" + ><span class="annot" + ><span class="annottext" + >qux :: () +</span + ><a href="TemplateHaskellSplices.html#qux" + ><span class="hs-identifier hs-var hs-var" + >qux</span + ></a + ></span + ></span + ><span + > </span + ><span class="hs-glyph" + >=</span + ><span + > </span + ><span class="annot" + ><span class="annottext" + >() -> () +forall a. a -> a +</span + ><span class="hs-identifier hs-var" + >id</span + ></span + ><span + > </span + ><span class="hs-special" + >$$</span + ><span class="hs-special" + >(</span + ><span class="annot" + ><a href="TemplateHaskellQuasiquotes.html#typedExpr" + ><span class="hs-identifier hs-type" + >typedExpr</span + ></a + ></span + ><span class="hs-special" + >)</span + ><span + > +</span + ><span id="line-14" + ></span ></pre ></body ></html diff --git a/hypsrc-test/src/TemplateHaskellQuasiquotes.hs b/hypsrc-test/src/TemplateHaskellQuasiquotes.hs index 7fafc7aa..c9498320 100644 --- a/hypsrc-test/src/TemplateHaskellQuasiquotes.hs +++ b/hypsrc-test/src/TemplateHaskellQuasiquotes.hs @@ -36,5 +36,11 @@ aType = [t| [ (Double, String) ] |] +typedExpr1 :: Code Q () +typedExpr1 = [|| () ||] + +typedExpr :: Code Q () +typedExpr = [|| const $$(typedExpr1) () ||] + diff --git a/hypsrc-test/src/TemplateHaskellSplices.hs b/hypsrc-test/src/TemplateHaskellSplices.hs index f8a859a0..66af36a3 100644 --- a/hypsrc-test/src/TemplateHaskellSplices.hs +++ b/hypsrc-test/src/TemplateHaskellSplices.hs @@ -7,3 +7,7 @@ import TemplateHaskellQuasiquotes $(aDecl) foo = id $(anExpression2) + +pat $(aPattern) = () + +qux = id $$(typedExpr) |