NOTE: prohibited from using ++ in your code.
join :: ([t],[t]) -> [t]
which takes a pair of lists of some type t, (xs,ys) and returns a single list that contains all the elements some testcases :
join ([],[])) "==" [])
join ([],[5,6,5])) "==" [5,6,5]
join ([7],[5,6,5])) "==" [7,5,6,5]
join ([3,7],[5,6,5])) "==" [3,7,5,6,5]
join ("be","happy")) "==" "behappy"
This is what I currently have
module Sum where
join :: ([t],[t]) -> [t]
join x y = [ z | z <- x, a <- y]
the error I get is
Sum.hs:3:1: error:
* Couldn't match expected type `[t]'
with actual type `[t0] -> [a0]'
* The equation(s) for `join' have two arguments,
but its type `([t], [t]) -> [t]' has only one
* Relevant bindings include
join :: ([t], [t]) -> [t] (bound at Sum.hs:3:1)
|
3 | join x y = [ z | z <- x, a <- y]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Sum.hs:3:23: error:
* Couldn't match expected type `[a0]' with actual type `([t], [t])'
* In the expression: x
In a stmt of a list comprehension: z <- x
In the expression: [z | z <- x, a <- y]
* Relevant bindings include
x :: ([t], [t]) (bound at Sum.hs:3:6)
join :: ([t], [t]) -> [t] (bound at Sum.hs:3:1)
|
3 | join x y = [ z | z <- x, a <- y]
| ^