-- Given a definition of view which is essentially a synonym for show:

class View a where
    view :: a -> String

instance View Int where
    view = show

-- why does "show 2" compile, while "view 2" gives an
-- 'Ambiguous type variable' error

fine                  = view (2::Int)
noProblem             = show 2
ambiguousTypeVariable = view 2

_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to