{-# LANGUAGE Haskell2010 #-}
module Quasiquoter ( string ) where

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

-- | Quoter for constructing multiline string literals
string :: QuasiQuoter
string :: QuasiQuoter
string = QuasiQuoter :: (String -> Q Exp)
-> (String -> Q Pat)
-> (String -> Q Type)
-> (String -> Q [Dec])
-> QuasiQuoter
QuasiQuoter
  { quoteExp :: String -> Q Exp
quoteExp = Exp -> Q Exp
forall (f :: * -> *) a. Applicative f => a -> f a
pure (Exp -> Q Exp) -> (String -> Exp) -> String -> Q Exp
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Lit -> Exp
LitE (Lit -> Exp) -> (String -> Lit) -> String -> Exp
forall b c a. (b -> c) -> (a -> b) -> a -> c
. String -> Lit
StringL
  , quotePat :: String -> Q Pat
quotePat = String -> Q Pat
forall a. String -> Q a
invalidDomain
  , quoteType :: String -> Q Type
quoteType = String -> Q Type
forall a. String -> Q a
invalidDomain
  , quoteDec :: String -> Q [Dec]
quoteDec = String -> Q [Dec]
forall a. String -> Q a
invalidDomain
  }
  where
    invalidDomain :: String -> Q a
    invalidDomain :: forall a. String -> Q a
invalidDomain String
_ = String -> Q a
forall (m :: * -> *) a. MonadFail m => String -> m a
fail String
"stringQuoter: only valid in expression context"