summaryrefslogtreecommitdiff
path: root/tests/examples/ghc86/TH_repGuardOutput.hs
blob: 0f02324e102ab62e7a7bb223c640fed7f987e988 (plain)
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
-- test the representation of unboxed literals
{-# LANGUAGE TemplateHaskell #-}

module Main
where

$(
    [d|
        foo :: Int -> Int
        foo x
         | x == 5 = 6
        foo x = 7
      |]
 )

$(
    [d|
        bar :: Maybe Int -> Int
        bar x
         | Just y <- x = y
        bar _ = 9
      |]
 )

main :: IO ()
main = do putStrLn $ show $ foo 5
          putStrLn $ show $ foo 8
          putStrLn $ show $ bar (Just 2)
          putStrLn $ show $ bar Nothing