Monomorphism, monomorphism...
Marcin 'Qrczak' Kowalczyk
qrczak@knm.org.pl
Wed, 24 Oct 2001 13:18:12 +0000 (UTC)
Wed, 24 Oct 2001 10:36:22 +0200, Hannah Schroeter <uk1o@rz.uni-karlsruhe.de> pisze:
> Why not create a dictionary record while compiling the associated
> instance (which may, by the H'98 definition, occur only once in
> the program)?
Instances with contexts are commonly represented as functions which
make dictionaries from other dictionaries. So although the function
itself is only one, it may be applied many times to the same argument,
and we want to unify results of the application, pretending that there
exists only one instance for Eq [[[[Int]]]].
> Yes, of course. It's a similar problem like in Cayenne, where type checking
> could take infinite time, too. (And what about current ghc Haskell,
> with multiple parameter type classes, overlapping instances, perhaps
> even -fallow-undecidable-...?!)
The same.
module Test where
class C a where f :: a
instance C a => C a
main = print (f :: ())
[qrczak ~]$ ghc -c -fglasgow-exts -fallow-undecidable-instances Test.hs
Test.hs:4:
Context reduction stack overflow; size = 21
Use -fcontext-stack20 to increase stack size to (e.g.) 20
`C ()' arising from use of `f' at Test.hs:4
`C ()' arising from use of `f' at Test.hs:4
`C ()' arising from use of `f' at Test.hs:4
`C ()' arising from use of `f' at Test.hs:4
`C ()' arising from use of `f' at Test.hs:4
`C ()' arising from use of `f' at Test.hs:4
`C ()' arising from use of `f' at Test.hs:4
`C ()' arising from use of `f' at Test.hs:4
`C ()' arising from use of `f' at Test.hs:4
`C ()' arising from use of `f' at Test.hs:4
`C ()' arising from use of `f' at Test.hs:4
`C ()' arising from use of `f' at Test.hs:4
`C ()' arising from use of `f' at Test.hs:4
`C ()' arising from use of `f' at Test.hs:4
`C ()' arising from use of `f' at Test.hs:4
`C ()' arising from use of `f' at Test.hs:4
`C ()' arising from use of `f' at Test.hs:4
`C ()' arising from use of `f' at Test.hs:4
`C ()' arising from use of `f' at Test.hs:4
`C ()' arising from use of `f' at Test.hs:4
`f at [()]' arising from use of `f' at Test.hs:4
When generalising the type(s) for main
--
__("< Marcin Kowalczyk * qrczak@knm.org.pl http://qrczak.ids.net.pl/
\__/
^^ SYGNATURA ZASTĘPCZA
QRCZAK