[Haskell-beginners] (Integral a) => a vs Integer

Dan Ross dan at rosspixelworks.com
Tue Jul 12 18:20:57 CEST 2011


Hi all-

I'm going through Learn You a Haskell for Great Good and I don't 
understand the advantage of using (Integral a)=> a vs just Integer as I 
show below.

Could someone explain this to me?

Thanks,

Dan

lucky :: (Integral a) => a -> String
lucky 7 = "LUCKY NUMBER SEVEN!"
lucky x = "Sorry, you're out of luck, pal!"

lucky :: Integer -> String
lucky 7 = "LUCKY NUMBER SEVEN!"
lucky x = "Sorry, you're out of luck, pal!"



More information about the Beginners mailing list