[Haskell-cafe] fromIntegral not enough?

Tom Ellis tom-lists-haskell-cafe-2013 at jaguarpaw.co.uk
Tue May 14 00:43:41 CEST 2013


On Mon, May 13, 2013 at 02:08:26PM -0800, Christopher Howard wrote:
> instance Integral a => Coord2 (CircAppr a) where
> 
>   coords2 (CircAppr divns ang rad) =
>       let dAng = 2 * pi / (fromIntegral divns) in
>       let angles = map (* dAng) [0..divns] in
>       undefined -- To be coded...

Your definition of "angles" forces "dAng" to be of type "a".  Then in order
to define "dAng" as the result of a "/" there must be a "Fractional" instance for
"a".

Hope that helps.

Tom



More information about the Haskell-Cafe mailing list