oke,

I try it with this :

acc :: a -> Maybe a -> Maybe a
acc a acc  = if null a then Nothing else if (null (tail a)) then (Just acc) else acc  a acc

If a = null so a empty input then the output = Nothing
else
if the tail a  is empty so there is only 1 item then the output must be acc
else
must be run again ( there is a list with more then 1 item)

but now I see this error message :

Couldn't match expected type ‘a -> Maybe a -> Maybe a’ with actual type ‘Maybe a’ Relevant bindings include acc :: Maybe a

and that is on the else part

Roelof





Benjamin Edwards schreef op 10-11-2014 18:07:
> It is complining but as soon as I want to run it , I see this message : 

> Non-exhaustive patterns in function acc 

Yep, Maybe has two constructors, and you are only handling one. You should handle the Nothing case as well.

_______________________________________________
Beginners mailing list
Beginners@haskell.org
http://www.haskell.org/mailman/listinfo/beginners