summaryrefslogtreecommitdiff
path: root/testsuite/tests/unboxedsums/unboxedsums12.hs
blob: 93f1793e8ab6ab330430f74993521c6a42aaa020 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
{-# LANGUAGE UnboxedSums, MagicHash, UnboxedTuples #-}

module Lib where

import GHC.Prim

data B = B1 Int# Int# Int# Int# Int# | B2 Float#

type UbxB = (# (# Int#, Int#, Int#, Int#, Int# #) | Float# #)

{-# INLINE bToSum #-}
bToSum :: B -> UbxB
bToSum (B1 i1 i2 i3 i4 i5) = (# (# i1, i2, i3, i4, i5 #) | #)
bToSum (B2 f) = (# | f #)

data C = C UbxB UbxB UbxB

mkC :: B -> C
mkC b = C (bToSum b) (bToSum b) (bToSum b)