
Newbie helping newbie, cool J And indeed, this is an amazing mailing list!
Personally, I prefer to read fromIntegral :: (Num b, Integral a) => a -> b
like
IF (b is a Num) AND (a is an Integral) THEN (fromIntegral is defined and is
a function from a to b)
This way it resembles the mathematical symbol for implication (=>)
PS: Haskells "generic number system" can be very confusing for the beginner,
but it becomes very cool when you start working with type classes. You will
see that in the later chapters of the great SOE book (animation and
reactive behaviors). The reactive behavior chapter is really hard, but don't
give up. In my case I got a real revelation, finally understanding the real
power of streams and lazy evaluation; it really changes the way you look at
the "world". As a videogames developer, I still have a lot of unanswered
questions though (for example, how to efficiently handle events between
behaviors, like collision, but I hope to find that in Yampa or newer work)
From: haskell-cafe-bounces@haskell.org
[mailto:haskell-cafe-bounces@haskell.org] On Behalf Of Balu Raman
Sent: Wednesday, June 27, 2007 5:37 PM
To: Haskell-Cafe@haskell.org
Subject: Re: [Haskell-cafe] New New newbie question/help
I am for ever obliged to this haskell community. Who would have thought that
Prof.Hudak would reply instantly, from on-the-road. I am reading his SOE.
Thanks so much.
I went with peterv's response after trying so many things.
I tried to change to : equilateralTri Window -> Float -> Float -> Float ->
IO()
which bombed because polygon wants list of integer-pairs.
I read the definitions of fromIntegral and round and they are defined as :
fromIntegral :: (Num b, Integral a) => a -> b
round :: (RealFrac a, Integral b) => a->b
Is it proper/ok to defines them as :
fromIntegral :: (a::Integral) -> (b::Num)
and
round :: (a::RealFrac) -> (b::Integral) ?
Is RealFrac is-a Num ?
Does the order matters in (Num b,Integral a) => a -> b or
(Integral a,Num b) => a -> b
With your encouragements, I'll keep pluuging. Thanks.
- br
On 6/27/07, peterv