data Tegel = Teg Int Int
type RijTegels = [Tegel]
volleRijTegels :: RijTegels
volleRijTegels = ziptwee [21..36] (replicate 4 1 ++ replicate 4 2 ++ replicate 4 3 ++ replicate 4 4)
ziptwee :: [Int] -> [Int] -> RijTegels
ziptwee [] [] = []
ziptwee (x:xs) (y:ys) = Teg x y: ziptwee xs ys
Now I use two functions, but I want to do it with one. I thought I could use zipWith, but I can't seem to figure out how.
volleRijTegels :: RijTegels
volleRijTegels = [zipWith (++) [1,2,3] [4,5,6]] -- here it is going wrong
I am placing the outer brackets wrong I guess, but I don't know where they should go.
Anyone who could show me how the work is done?
The problem here is that you want the type
RijTegelsbut actually the type you're creating withzipWith (++)is[[a]]. So to change that you could use the type constructor instead of the(++):Try it online!