You need some parenthesis:
mergeX [] b res = b ++ res
mergeX a [] res = a ++ res
mergeX (a:as) (b:bs) res
| a > b = mergeX as (b:bs) (a:res)
| otherwise = mergeX (a:as) bs (b:res)
The reason is because :
has a lower precedence than function application, so mergeX a:as b:bs res
will be parsed as:
(mergeX a):(as b):(bs res)
which is an error.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…