This is my situation.
I want to make this rule:
{-# RULES "++ 1 element" forall x xs. (x:[]) ++ xs = x:xs #-}
However, I have OverloadedLists enabled, so this becomes.
{-# RULES "++ 1 element" forall x xs. (x:(fromList [])) ++ xs = x:xs #-}
Is there a way to avoid this automatic fromList? Also, I’d like to be able to just say that a list is normal for readability.
My soultion was to do this:
Make a helper function special casing those situations and just inline that instead.
(+++) :: [a] -> [a] -> [a]
(+++) [] x = x
(+++) [a] x = a:x
(+++) xs ys = xs ++ ys
{-# INLINE (+++) #-}
But I’m still curious for a way to say that a list is of type [a] without using a type signature.