[m-users.] Usage of inst subtypes with list.foldl in rotd

Dirk Ziegemeyer dirk at ziegemeyer.de
Thu Mar 5 05:53:18 AEDT 2015


>> Is there a way, I could use list.foldl from the standard library again?
> 
> Not that I know of.  I wouldn't recommend this either as your program was
> always mode-incorrect but the compiler didn't do a very good job of telling
> you.  I agree that it is uncomfortable that this is now incompatible.

Thank you for the clarification. I was not aware of that I used list.foldl in an unintended way.

> I suggest creating your own mode-polymorphic foldl predicate, similar to
> what you have done, and making it part of your application.  You will
> probably need to name it something other than foldl so I suggest
> foldl_modepoly.
> 
> The long term solution to this is to make the predicates in the standard
> library mode-polymorphic.  The legend (it was before I joined the project)
> is that when we tried this mode analysis was too slow and the costs
> outweighed the benefits.  Someone ought to correct me if I'm wrong.

Making my own mode-polymorphic foldl predicate(s) is my preferred solution as long as the standard library is not mode-polymorphic.

Best regards,

-- 
Dirk Ziegemeyer




More information about the users mailing list