14.1 - -- Preferable: The pattern matching version. Only...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
--14.1 data Temp = Cold | Hot deriving (Show) data Season = Spring | Summer | Autumn | Winter deriving (Eq) weather :: Season -> Temp weather season | season == Summer = Hot | otherwise = Cold
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: -- Preferable: The pattern matching version. Only two thirds of the-- number of lines ;-). Plus, the "guards" version requires season -- to be of type "Eq"...
View Full Document

Ask a homework question - tutors are online