{-# LANGUAGE Haskell2010 #-}
{-# LANGUAGE TemplateHaskell #-}

module TemplateHaskellQuasiquotes where

import Language.Haskell.TH

aDecl :: DecsQ
aDecl :: DecsQ
aDecl = [d|
    bar :: $TypeQ
aType -> [ (Int, String) ]
    bar $PatQ
aPattern = $ExpQ
anExpression
  |]

aPattern :: PatQ
aPattern :: PatQ
aPattern = [p|
    [ aCrazyLongVariableName
    , _unused
    , (y, z)
    , ( $PatQ
aNumberPattern, "hello")
    ]
  |]

aNumberPattern :: PatQ
aNumberPattern :: PatQ
aNumberPattern = [p|
    w@v@4.5
  |]

anExpression, anExpression2 :: ExpQ
anExpression :: ExpQ
anExpression = [e|
    [ (1 + $ExpQ
anExpression2, "world") ]
  |]
anExpression2 :: ExpQ
anExpression2 = [| (1 + round pi) |]

aType :: TypeQ
aType :: TypeQ
aType = [t|
    [ (Double, String) ]
  |]

typedExpr1 :: Code Q ()
typedExpr1 :: Code Q ()
typedExpr1 = [|| () ||]

typedExpr :: Code Q ()
typedExpr :: Code Q ()
typedExpr = [|| a -> b -> a
forall a b. a -> b -> a
const $$(Code Q ()
typedExpr1) () ||]