I think it should be possible to do

instance Functor List where fmap f xs = if null xs then empty else cons (f $ head xs) (fmap f $ tail xs)

but that would need an `AdaptList`

constraint on the data type family `List`

?

elimList :: b -> (a -> List a -> b) -> List a -> b

Which would clean up the code a lot, but I don’t know about performance.

]]>On a side note, it seems that such “strict unpacked lists” of type [!a] (which is currently not valid) can be easily introduced at the compiler’s level. When compiler encounters application f x (f :: [a] -> b, x :: [!b]) it can just try to generate a special version of f adopted to the representation of x (unpacked elements).

]]>