I'm trying to write my own and function in Haskell. It looks like:
and' :: [Bool] -> Bool
and' (x:xs) = x && and' xs
When I use and' [True, True, True] it gives me exception:
*** Exception: 6.hs:27:1-26: Non-exhaustive patterns in function and'
I figured out that adding: and' _ = True fixes my problem, but actually why do I have to add this line? If my way of thinking is correct function should return me True && True && True and when I use this combination in ghci it returns True. Could you explain me it please? Is there a way to see implementation of function and in ghci?