<jacek.generow...@cern.ch> wrote:
-- 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
On 2010 Oct 16, at 01:25, Daniel Fischer wrote:
http://www.haskell.org/onlinereport/haskell2010/haskellch4.html#x10-790004.3.4
Defaulting only takes place when all involved classes are defined in
the
Prelude or the standard libraries.
Your View class isn't, hence there's no defaulting.
Bingo. Thank you.
_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe