At 2002-01-21 02:04, Koen Claessen wrote:

>But from the type you give the function `emptyList':
>
>  emptyList :: Ord a => [a]
>
>we cannot derive that the type of the function `emptyList'
>does not matter for its result. So, the type checker will
>complain.

That's it! Consider:

--
class C a where
        emptyList :: [a]

instance C Int where
        emptyList = []

instance C Char where
        emptyList = "Hello"
--

Clearly emptyList has type "(C a) => [a]"...

So in the original example, (validActions actor) cannot be compared to 
the empty list because its value may depend on the type of u. This would 
not be possible if there were no (Action u) context.

-- 
Ashley Yakeley, Seattle WA


_______________________________________________
Haskell-Cafe mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to