I was given merge as below:
merge :: Ord a => [a] -> [a] -> [a]
merge xs [] = xs
merge [] ys = ys
merge (x:xs) (y:ys)
| x == y = x : merge xs ys
| x <= y = x : merge xs (y:ys)
| otherwise = y : merge (x:xs) ys
and
type Var = String
now I want to merge ['a' .. 'z'] with [1....] to create infinite list of variables. ['a1','b1','c1'...'z1','a2','b2',...'z2',...]
I have defined my variables as below:
variables :: [Var]
variables = merge ['a'..'z'][1..]
But I'm getting below error:
error:
• Couldn't match type ‘Char’ with ‘[Char]’
Expected type: [Var]
Actual type: [Char]
• In the expression: merge ['a' .. 'z'] [1 .. ]
In an equation for ‘variables’:
variables = merge ['a' .. 'z'] [1 .. ]
|
50 | variables = merge ['a'..'z'][1..]
| ^^^^^^^^^^^^^^^^^^^^^
what am I getting wrong here ? Please help...thanks in advance!