-- | The Prelude defines the most common data types and functions for -- | us, but the LANGUAGE construct at the top of the page excludes the -- | normally automatically imported Prelude. Here we add back in what -- | we might need in this module. import Prelude (Show, IO, Int, putStrLn, ($), show, (++)) -- | our own version of a list datatype data Lst a = NIL | Cons a (Lst a) deriving (Show) -- | our own version of a boolean datatype data Booly = Yep | Nope deriving (Show) -- | Returns true if an instance of @Lst@ is empty, false otherwise isEmpty :: Lst a -> Booly isEmpty NIL = Yep isEmpty _ = Nope ex01 :: Lst Int ex01 = Cons 1 (Cons 2 (Cons 3 (Cons 4 NIL))) main :: IO () main = putStrLn $ "ex1 : " ++ (show ex01)