Nope, it's in the Haskell standard. It means we can type: 1 + (2 :: Int) and have it work
Otherwise what type would 1 have? Integer? Float? It's just a way of giving constants the type :: Num a => a On Fri, May 8, 2009 at 4:53 PM, Andrew Wagner <wagner.and...@gmail.com> wrote: > Hmm, I never knew that. Is that a GHC thing? Is it strictly necessary? Seems > like it could be done in the Num instance for Integers, Ints, etc. > > On Fri, May 8, 2009 at 11:51 AM, Neil Mitchell <ndmitch...@gmail.com> wrote: >> >> > Err, I'm not seeing the danger of this >> > (+) :: forall a. (Num a) => a -> a -> a >> > Doesn't this require the two parameters to be the same instance of Num? >> >> I didn't at first, then I remembered: >> >> 1 + True >> = >> fromInteger 1 + True >> >> And if we have Num for Bool, it type checks. >> >> Thanks >> >> Neil > > _______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe