One of the problems (as I understand it) is that ++ not a list data type constructor in a way : You may think that the list data type is defined as
data [a] = [] | a : [a]
Where : - a constructor that adds elements to the top of the list. However ++ is a function (defined in the documentation here: http://hackage.haskell.org/package/base-4.8.1.0/docs/src/GHC.Base.html#%2B%2B ) as
(++) :: [a] -> [a] -> [a] (++) [] ys = ys (++) (x:xs) ys = x : xs ++ ys
We could define our own list of data types, for example
data List a = Empty | Cons a (List a)
This would mimic the behavior of our familiar list. In fact, you can use (Cons val) in the template. I believe that you can also define a type with a concat constructor this way
data CList a = Empty | Cons a (CList a) | Concat (CList a) (CList a)
What you can use to lazily combine two lists and defer joining them to one. With this type of data, you could match the match with Concat xs ys input, but you would only work on the border of two lists, not in the middle of one.
Anyway, I'm still pretty new to Haskell, but hope this is in place.
source share