{-# 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,

--
-- Mirko Rahn -- Tel +49-721 608 7504 --
--- http://liinwww.ira.uka.de/~rahn/ ---
_______________________________________________
Glasgow-haskell-users mailing list
Glasgow-haskell-users@haskell.org
http://www.haskell.org/mailman/listinfo/glasgow-haskell-users

Reply via email to