File: TemplateHaskell.hs

package info (click to toggle)
haskell-ghc-exactprint 1.7.1.0-1
  • links: PTS
  • area: main
  • in suites: forky, sid, trixie
  • size: 6,044 kB
  • sloc: haskell: 32,076; makefile: 7
file content (43 lines) | stat: -rw-r--r-- 873 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
{-# LANGUAGE TemplateHaskell #-}
{-# LANGUAGE QuasiQuotes #-}

foo = $footemplate

makeSplices ''Foo

old = $(old)

bar = $$bartemplate

bar = [e| quasi |]

bar = [| quasi |]

baz = [quoter| quasi |]

[t| Map.Map T.Text $tc |]

{-# ANN module $([| 1 :: Int |]) #-}

foo = [t| HT.HashTable $(varT s) Int
                   (Result $(varT str) $tt) |]

objc_emit

objc_import [""]


$(do
    return $ foreignDecl cName ("build" ++ a) ([[t| Ptr Builder |]] ++ ats ++ [[t| CString |]]) [t| Ptr $(rt) |]
 )

foo = do
  let elemSize = [|sizeOf (undefined :: $(elemType))|]
      alignment _ = alignment (undefined :: $(elemType))
  return bar

class QQExp a b where
  qqExp x = [||fst $ runState $$(qqExpM x) ((0,M.empty) :: (Int,M.Map L.Name [L.Operand]))||]

class QQExp2 a b where
  qqExp x = [e||fst $ runState $$(qqExpM x) ((0,M.empty) :: (Int,M.Map L.Name [L.Operand]))||]