[Haskell-cafe] Re: -fno-monomorphism-restriction makes
type-inference ambiguous?
Ben Rudiak-Gould
Benjamin.Rudiak-Gould at cl.cam.ac.uk
Mon Feb 27 13:46:36 EST 2006
Eike Scholz wrote:
>> mylength = synAttr listLength
>
> $ *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
>
> where
>
>> type Attr a = Dyn -> Dyn -> [Dyn]-> Maybe a
This may be a bug. But note that both interpretations are legitimate. One
way of applying synAttr to listLength is first to apply ?stack to
listLength, obtaining listLength' :: List -> Float and creating a
(?stack::[Dyn]) constraint on the application node, then specializing
listLength' to the type (?stack::a) => List -> Float, then passing that to
synAttr.
Again, I recommend that you not try to use implicit parameters.
-- Ben
More information about the Haskell-Cafe
mailing list