Need some help with basic Haskell


Need some help with basic Haskell

data Product = Baseball | Basketball totalPrice :: Product -> Float -> Float totalPrice x y = case x of Baseball | y >= 1 && y <= 15 = y*10 | y >= 15 && y <= 40 = y*9.5 | y >= 41 && y <= 150 = y*9 | y >= 151 && y <= 400 = y*8.5 | y >= 401 = y*8 | otherwise == error "Something's wrong" Basketball | y >= 1 && y <= 7 = y*14 | y >= 8 && y <= 14 = y*13 | y >= 15 && y <= 23 = y*12.4 | y >= 24 && y <= 40 = y*11 | y >= 41 = y*10.3 | otherwise == error "Something's wrong" 

Hi all! I'm new to Haskell and trying to do this function but can't compile it to run. The compilation error is "parse error (possibly incorrect indentation or mismatched brackets)". Any help is really appreciated 🙂

Submitted August 12, 2017 at 05:22PM by manofhumankind
via reddit http://ift.tt/2hTNMva

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s