Skip to content
Snippets Groups Projects
Forked from Glasgow Haskell Compiler / GHC
5433 commits behind the upstream repository.
Code owners
Assign users and groups as approvers for specific file changes. Learn more.
unpack_sums_8.hs 514 B
{-# LANGUAGE UnboxedTuples #-}
{-# LANGUAGE UnboxedSums #-}

module Main where

data Void
data WithVoid = LV Void | RV
data EnumT = L | R
    deriving Show

data BoxEnum = BoxEnum {-# UNPACK #-} !EnumT
    deriving Show

l = BoxEnum L
r = BoxEnum R

main = do
    print l
    print r


data BoxWithVoid = BoxWithVoid {-# UNPACK #-} !WithVoid
wv = BoxWithVoid (LV undefined)

data BoxVoid = BoxVoid {-# UNPACK #-} Void
bv = BoxVoid undefined

data BoxSum = BoxS {-# UNPACK #-} !(# Int | Char #)
bs = BoxS (# 1 | #)