File tree Expand file tree Collapse file tree 3 files changed +43
-0
lines changed
tests/template-haskell-with-cbits Expand file tree Collapse file tree 3 files changed +43
-0
lines changed Original file line number Diff line number Diff line change 1+ load (
2+ "@rules_haskell//haskell:defs.bzl" ,
3+ "haskell_test" ,
4+ )
5+
6+ package (default_testonly = 1 )
7+
8+ haskell_test (
9+ name = "template-haskell-with-cbits" ,
10+ srcs = [
11+ "Main.hs" ,
12+ "TH.hs" ,
13+ ],
14+ deps = [
15+ "//tests/data:ourclibrary" ,
16+ "//tests/hackage:base" ,
17+ "//tests/hackage:template-haskell" ,
18+ ],
19+ )
Original file line number Diff line number Diff line change 1+ {-# LANGUAGE TemplateHaskell #-}
2+
3+ module Main where
4+
5+ import Control.Monad (unless )
6+ import System.Exit (exitFailure )
7+ import System.IO (hPutStrLn , stderr )
8+ import TH (value )
9+
10+ main :: IO ()
11+ main =
12+ unless ($ (value) == 42 ) $ do
13+ hPutStrLn stderr " Expected 42"
14+ exitFailure
Original file line number Diff line number Diff line change 1+ {-# LANGUAGE TemplateHaskell #-}
2+
3+ module TH where
4+
5+ import Language.Haskell.TH
6+
7+ foreign import ccall " c_add_one" c_add_one' :: Int -> Int
8+
9+ value :: Q Exp
10+ value = [| c_add_one' 41 | ]
You can’t perform that action at this time.
0 commit comments