Haskell: GADT with UNPACK Pragma

UNPACK supports regular data types, as shown below:

data T = T {-# UNPACK #-} ! Int 

But is there a way to use UNPACK Pragma with GADT?

+5
source share
1 answer

Tried this and found that it really works with the constructor arguments.

 data BinHeap a where Empty :: (Ord a) => BinHeap a HeapNode :: (Ord a) => a -> {-# UNPACK #-} !Int -> BinHeap a -> BinHeap a -> BinHeap a 

Nice.

+8
source

Source: https://habr.com/ru/post/1244948/


All Articles