UNPACK supports normal data types, as shown in the following:
data T = T {-# UNPACK #-} ! Int
But is there a way to use the UNPACK Pragma with GADT?
Tried it and found that it actually works with Constructor function arguments.
data BinHeap a where
Empty :: (Ord a) => BinHeap a
HeapNode :: (Ord a) => a -> {-# UNPACK #-} !Int -> BinHeap a -> BinHeap a -> BinHeap a
Nice.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With