A simple problem

Ashley Yakeley ashley@semantic.org
Thu, 18 Jan 2001 15:38:10 -0800


At 2001-01-18 05:16, Saswat Anand wrote:

>class C a where
> fun :: a -> Integer
>
>instance C Integer where
> fun x = x+ 1
>
>with these definitons: 
>
>fun 3  --gives error in Hugs
>fun (3::Integer) -- OK
>
>I am a building an embedded language, so don't want user to cast. Is there a
>solution?

3 is not always an Integer. It's of type "(Num a) => a".

I couldn't find a way to say that every Num is a C.

-- 
Ashley Yakeley, Seattle WA