A GADT version seems to generate OK code: data Top data NTop data Rope t where Empty :: Rope Top Leaf :: Rope NTop Node :: !(Rope NTop) -> !(Rope NTop) -> Rope NTop
index :: Rope t -> Int -> Word8 index Empty _ = error "empty" index Leaf _ = error "leaf" index (Node l r) n = index' l n where index' :: Rope NTop -> Int -> Word8 index' Leaf _ = error "leaf" index' (Node l r) n = index' l n Here's the result of -O -ddump-simpl for index': $windex'_rx5 = \ (w_swu :: Tree.Rope Tree.NTop) -> case w_swu of wild_Xf { Tree.Leaf -> lvl1_rwZ; Tree.Node l_adF r_adG -> $windex'_rx5 l_adF } Regards, Zun. _______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe