[Haskell-beginners] how can I make this work

Alex Hammel ahammel87 at gmail.com
Tue May 12 18:11:11 UTC 2015


You're missing the parens around (x:yx) in the last clause.

On Tue, 12 May 2015 at 11:02 Roelof Wobben <r.wobben at home.nl> wrote:

>  Hello,
>
> I try to re implement ++
>
> So far I have this ;
>
> plusplus' :: [a] -> [a] -> [a]
> plusplus' [] (xs) = xs
> plusplus' [] [] = []
> plusplus' (xs) [] =  xs
> plusplus' (x:xs) yx = plusplus' xs x:yx
>
> main = print . plusplus' $ [1,2] [3,4]
>
>
> But I still get this error message :
>
> src/Main.hs at 5:23-5:37
> Couldn't match expected type
> a
>  with actual type
> [a]
>  a
>  is a rigid type variable bound by the type signature for plusplus' :: [a]
> -> [a] -> [a] at
> /home/app/isolation-runner-work/projects/112825/session.207/src/src/Main.hs:1:14
> Relevant bindings include yx :: [a] (bound at
> /home/app/isolation-runner-work/projects/112825/session.207/src/src/Main.hs:5:18)
> xs :: [a] (bound at
> /home/app/isolation-runner-work/projects/112825/session.207/src/src/Main.hs:5:14)
> x :: a (bound at
> /home/app/isolation-runner-work/projects/112825/session.207/src/src/Main.hs:5:12)
> plusplus' :: [a] -> [a] -> [a] (bound at
> /home/app/isolation-runner-work/projects/112825/session.207/src/src/Main.hs:2:1)
>>
>
>
>
>
> ------------------------------
>   [image: Avast logo] <http://www.avast.com/>
>
> Dit e-mailbericht is gecontroleerd op virussen met Avast
> antivirussoftware.
> www.avast.com
>
>  _______________________________________________
> Beginners mailing list
> Beginners at haskell.org
> http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/beginners/attachments/20150512/4b0401cd/attachment.html>


More information about the Beginners mailing list