Skip to content

Check maximum Sum<n># arity at renamer

Summary

We have maximum size for both tuples and unboxed sums. These values are determined by mAX_TUPLE_SIZE = 64 and mAX_SUM_SIZE = 63. We check tuple size and emit TcRnTupleTooLarge message on tuple renaming, however we do nothing for unboxed sums.

Steps to reproduce

ghci> import Language.Haskell.TH
ghci> :set -XTemplateHaskell
ghci> :set -XUnboxedSums 
ghci> :k $(conT $ unboxedSumTypeName 256)
$(conT $ unboxedSumTypeName 256) :: *
                                    -> *
                                    -> *
                                    -> *
                                    -> *
                                    -> *
                                    -> *
                                    -> *
                                    -> *
... and so on ...

Expected behavior

The same as for tuples.

ghci> :k $(conT $ unboxedTupleTypeName 65)

<interactive>:1:2: error: [GHC-94803]
    • A 65-tuple is too large for GHC
        (max size is 64)
        Workaround: use nested tuples or define a data type
    • In the untyped splice: $(conT $ unboxedTupleTypeName 65)
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information