mirror of
https://github.com/ocharles/weeder.git
synced 2024-11-22 22:42:10 +03:00
Extend TemplateHaskell test
This commit is contained in:
parent
b8006fe0c8
commit
6aa54d64b5
@ -1,4 +1,4 @@
|
||||
module Spec.TemplateHaskell.TH (intQQ, oneQ) where
|
||||
module Spec.TemplateHaskell.TH (intQQ, oneQ, twoQ, two) where
|
||||
|
||||
import Language.Haskell.TH
|
||||
import Language.Haskell.TH.Quote
|
||||
@ -9,6 +9,12 @@ oneQ = pure . LitE $ IntegerL one
|
||||
one :: Integer
|
||||
one = 1
|
||||
|
||||
two :: Int
|
||||
two = 2
|
||||
|
||||
twoQ :: Q Exp
|
||||
twoQ = pure . VarE $ mkName "two"
|
||||
|
||||
intQQ :: QuasiQuoter
|
||||
intQQ = QuasiQuoter
|
||||
{ quoteExp = pure . LitE . IntegerL . (zero1 +) . read
|
||||
|
@ -5,13 +5,13 @@
|
||||
|
||||
module Spec.TemplateHaskell.User where
|
||||
|
||||
import Spec.TemplateHaskell.TH (intQQ, oneQ)
|
||||
import Spec.TemplateHaskell.TH (intQQ, oneQ, twoQ, two)
|
||||
import GHC.TypeLits (Nat)
|
||||
|
||||
newtype T (a :: Nat) = T Int
|
||||
|
||||
root :: T [intQQ|1|]
|
||||
root = T $ $(oneQ) + [intQQ|1|] + quote + f (1 :: Int)
|
||||
root = T $ $(oneQ) + [intQQ|1|] + quote + f (1 :: Int) + $(twoQ)
|
||||
where
|
||||
f [intQQ|1|] = 1
|
||||
f _ = 1
|
||||
|
Loading…
Reference in New Issue
Block a user