aboutsummaryrefslogtreecommitdiff
path: root/hypsrc-test/src/Quasiquoter.hs
blob: d0a46c33f49a95bd14f18cfe8852527a769c59f7 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
module Quasiquoter ( string ) where

import Language.Haskell.TH.Quote
import Language.Haskell.TH.Syntax

-- | Quoter for constructing multiline string literals
string :: QuasiQuoter
string = QuasiQuoter
  { quoteExp = pure . LitE . StringL
  , quotePat = invalidDomain
  , quoteType = invalidDomain
  , quoteDec = invalidDomain
  }
  where
    invalidDomain :: String -> Q a
    invalidDomain _ = fail "stringQuoter: only valid in expression context"