[Haskell] -fno-monomorphism-restriction makes type-inference
ambiguous?
Eike Scholz
eikescholz at gmx.de
Mon Feb 27 10:19:27 EST 2006
Hi,
thanks for the last help and hints. I have encountered an other problem,
and again I don't quite understand the reason why I get the results I
get. ghci seems to infer different types for the same expression.
Consider that I have disabled the monomorphism restriction
in module AGC.lhs (which is attached).
and I have a toplevel definition of:
> mylength = synAttr listLength
loding the module in ghci (6.4) gives (beside some correct warnings):
$ Ok, modules loaded: Main.
$ *Main> :type synAttr
$ synAttr :: (Data b) => ((?stack::[Dyn]) => b -> a) -> Attr a
$ *Main> :type listLength
$ listLength :: (?stack::[Dyn]) => List -> Float
$ *Main> :type (synAttr listLength)
$ (synAttr listLength) :: Attr Float
$ *Main> :type mylength
$ mylength :: (?stack::[Dyn]) => Dyn -> Dyn -> [Dyn] -> Maybe Float
$ *Main> let mylength = synAttr listLength
$ *Main> :type mylength
$ mylength :: Dyn -> Dyn -> [Dyn] -> Maybe Float
where
> type Attr a = Dyn -> Dyn -> [Dyn]-> Maybe a
the problem I have is that inferred types for the toplevel declaration
mylength differ from the verbatim equal definition in the Let
experssion.
for the toplevel it infers:
mylength :: (?stack::[Dyn]) => Dyn -> Dyn -> [Dyn] -> Maybe Float
for the let-Binding
mylength :: Dyn -> Dyn -> [Dyn] -> Maybe Float
and this is what I expected.
Has anyone an Idea, why this happens?
best regards,
Eike Scholz
PS: Beware of the comments in the attached file. This file is under
heavy development. I am dyslexic and don't correct the comments
while continuously rewriting code and comments. I hope that the comments
are useful anyway.
The (+>) (~>) (#>) operators are broken at the moment and don't work the
way intended.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: AGC.lhs
Type: text/x-literate-haskell
Size: 8036 bytes
Desc: not available
Url : http://www.haskell.org//pipermail/haskell/attachments/20060227/99ffab4b/AGC.bin
More information about the Haskell
mailing list