gksato
IntSet みたいな~trie木~Patricia木を車輪の再開発しなければならなくなったのですが、型の御加護を受けつつ余計なreference indirectionを避けるために
data Patricia (inhabited :: Bool) :: Type where
Branch :: {-# UNPACK #-} !Word -> !(Patricia True) -> !(Patricia True) -> Patricia True
Tip :: {-# UNPACK #-} !Word -> Patricia True
Nil :: Patricia False
newtype Patricia' = forall b. Patricia' (Patricia b)みたいなことを考えたのですが、existential type って newtypeでは使えないようで、効率が悪そうというよりはただただ気持ち悪いです。empty と non-emptyを型で分離した上で、それらを統合するwrapperがheap中にもう一個できるのを回避するのは不可能でしょうか…。