summaryrefslogtreecommitdiff
path: root/testsuite/tests/th/TH_NestedSplices_Lib.hs
blob: 91d6173b916851ea3d7996894b44dab17d37f45b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
{-# LANGUAGE TemplateHaskell #-}
module TH_NestedSplices_Lib where

import Language.Haskell.TH

spliceExpr :: String -> Q Exp -> Q Exp
spliceExpr s e = [| (s, $e) |]

declareFun :: String -> Q [Dec]
declareFun s
  = do { n <- newName s
       ; d <- funD n [clause [] (normalB [| 22 |]) []]
       ; return [d] }