Open
Description
This compiles with GHC-9.4-alpha1:
{-# language UnliftedDatatypes, MagicHash #-}
module M where
import Data.Kind (Type)
import GHC.Exts
data Leaf k v :: UnliftedType where
L :: !k -> v -> Leaf k v
type HashMap' :: Type -> Type -> UnliftedType
data HashMap' k v
= Empty
| BitmapIndexed !Word !(SmallArray# (HashMap' k v))
| Leaf !Word !(Leaf k v)
| Full !(SmallArray# (HashMap' k v))
| Collision !Word !(SmallArray# (Leaf k v))
data HashMap k v = HM !(HashMap' k v)
If the ergonomics work out, maybe we could start using a similar representation around GHC 8.8.
The main benefit should be better performance due to the removal of heap checks.