Context not part of a function definition?
Graham Klyne
gk@ninebynine.org
Sun, 16 Mar 2003 14:25:39 +0000
I'm trying to use the following idiom to selectively import functions from
the List module:
import qualified List
nub = List.nub
but I'm finding that HUGS complains about "unresolved top level
overloading" with "outstanding context: "Eq b".
If I duplicate the type signature thus:
import qualified List
nub :: Eq a => [a] -> [a]
nub = List.nub
All seems to be well. I find it counter-intuitive that I cannot simply define
a = b
such that any occurrence of a is equivalent to an occurrence of b. I
thought that was the point of referential transparency in functional
languages. I don't know where to look in the Haskell documents to decide
whether the above is a bug or truly according to the language spec.
#g
-------------------
Graham Klyne
<GK@NineByNine.org>
PGP: 0FAA 69FF C083 000B A2E9 A131 01B9 1C7A DBCA CB5E