
30 May
2005
30 May
'05
7 p.m.
Am Montag, 30. Mai 2005 11:48 schrieb Mirko Rahn:
{-# OPTIONS -fglasgow-exts #-}
import Data.Map
class New a b where new :: a -> b
instance Ord a => New [(a,b)] (Map a b) where new = fromList
g :: Ord a => [a] -> Map a Int g xs = new $ zip xs [0..]
Why is ghc unable the determine the type of the Literal 0 in the definition of g?
Answer: Since somewhere an instance e.g. New [(a,Double)] (Map a Int) could be defined, leading to problems when threating 0 as (0::Int).
Thanks to private communication, Cheers,
It wasn't actually private, I accidentally sent it to haskell-cafe, sorry. Cheers, Daniel