File: StrQuote.hs

package info (click to toggle)
glirc 2.32-1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, sid
  • size: 872 kB
  • sloc: haskell: 12,748; ansic: 82; makefile: 6
file content (20 lines) | stat: -rw-r--r-- 469 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
{-|
Module      : StrQuote
Description : Template Haskell quasi-quoter for string literals
Copyright   : (c) Eric Mertens, 2017
License     : ISC
Maintainer  : emertens@gmail.com

-}
module StrQuote (str) where

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

str :: QuasiQuoter
str = QuasiQuoter
  { quoteExp  = stringE
  , quotePat  = pure . LitP . StringL
  , quoteType = pure . LitT . StrTyLit
  , quoteDec  = const (fail "str is for expressions")
  }