{-# LANGUAGE NoImplicitPrelude #-}
module Main where
import Prelude
import Data.Char (toLower)
main :: IO ()
main = putStrLn $ if test then "SUCCESS" else "FAILURE"
newtype Email = Email { unEmail :: String }
test :: Bool
test = and [ Email "tony@stark.com" == Email "tony@stark.com"
, Email "Tony@Stark.com" == Email "tony@stark.com"
, Email "Tony@ironman.com" /= Email "tonn@stark.com"
]
-- TODO: This program doesn't compile. Define the missing function(s) incl. type signatures!
{-# LANGUAGE NoImplicitPrelude #-}
module Main where
import Prelude
import Data.Char (toLower)
main :: IO ()
main = putStrLn $ if test then "SUCCESS" else "FAILURE"
newtype Email = Email { unEmail :: String }
test :: Bool
test = and [ Email "tony@stark.com" == Email "tony@stark.com"
, Email "Tony@Stark.com" == Email "tony@stark.com"
, Email "Tony@ironman.com" /= Email "tonn@stark.com"
]
-- DONE
instance Eq Email where
(==) a b = let lower = fmap toLower in
lower (unEmail a) == lower (unEmail b)