Project Inquiry

Implement Prelude.or

Challenge
{-# LANGUAGE NoImplicitPrelude #-}

module Main where

import           Prelude hiding (or)

main :: IO ()
main = putStrLn $ if test then "SUCCESS" else "FAILURE"

test :: Bool
test = or [] == False &&
       or [True] == True &&
       or [False] == False &&
       or [False, True] == True &&
       or [False, True, False] == True

-- TODO: This program doesn't compile. Define the missing function(s) incl. type signatures!
Solution
{-# LANGUAGE NoImplicitPrelude #-}

module Main where

import           Prelude hiding (or)

main :: IO ()
main = putStrLn $ if test then "SUCCESS" else "FAILURE"

test :: Bool
test = or [] == False &&
       or [True] == True &&
       or [False] == False &&
       or [False, True] == True &&
       or [False, True, False] == True

-- DONE
or :: [Bool] -> Bool
or []     = False
or (x:xs) = x || or xs