[Haskell] -fno-monomorphism-restriction makes type-inference ambiguous?

John Meacham john at repetae.net
Mon Feb 27 20:27:40 EST 2006


On Mon, Feb 27, 2006 at 04:42:32PM +0100, Johannes Waldmann wrote:
> Implicit parameters are *evil*. They seem to simplify programs
> but they make reasoning about them much harder.

Indeed. We really need some big caveats in the manual. I find a lot of
new users think they are what they need and just end up frustrated and
don't like to hear "Oh, you shouldn't have used those" after the fact.

> To an extent, they can be simulated with type classes,
> because dictionaries are also implicit (you don't see them in the code
> but you see them in the type declaration - same as for implicit parameters).

I think a Reader monad is the best way to do this sort of thing,
converting to real parameters is as simple as 'ask' and even better yet
when you realize you need something trickier like the ability to collect
values or a unique name supply, stacking a WriterT or a StateT or
whatever is simple after the fact.


        John

-- 
John Meacham - ⑆repetae.net⑆john⑈


More information about the Haskell mailing list