summaryrefslogtreecommitdiff
path: root/testsuite/tests/simplCore/should_run/T5453.hs
blob: 19a3a3ca86f39eff2ab465ac1f6d27a7144b2eac (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
{-# LANGUAGE MagicHash #-}
module Main where

import GHC.Exts

data Var = TyVar !Int Bool Bool
         | TcTyVar Bool !Int Bool
         | Var Bool Bool !Int
         deriving (Show)

scrut :: Var -> (Bool, String)
scrut v = (True, case v of
    TcTyVar {} -> "OK"
    _ -> show v ++ show (case (case v of
                                 TyVar b _ _ -> b
                                 Var _ _ b -> b) of
                           I# x# -> if isTrue# (x# ==# 7#)
                                    then show (I# (x# +# 1#))
                                    else show (I# (x# +# 2#))))

main = putStrLn $ snd (scrut (TcTyVar True 1 False))