summaryrefslogtreecommitdiff
path: root/testsuite/tests/unboxedsums/unboxedsums10.hs
blob: 00f5e548fae23e8ef10e88a510fd6e992330956c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
{-# LANGUAGE UnboxedSums, MagicHash #-}

module Main where

type Ty = (# (Int -> Int) | (Int -> Int) #)

{-# NOINLINE apply #-}
apply :: Ty -> Int
apply (# f | #) = f 0
apply (# | f #) = f 1

main :: IO ()
main = do
  print (apply (# (\x -> x * 2) | #))
  print (apply (# | (\x -> x * 3) #))