Making implicit parameters explicit

Stefan Reich doc at drjava.de
Thu Nov 6 22:16:45 EST 2003


Well yes, but what I actually want is to instantiate controllerList 
statically; the implicit parameter should ideally be embedded, like this:

   controllerList :: [(?req :: Request) => String]

I don't think that is a legal Haskell type though...

-Stefan

Tomasz Zielonka wrote:
>>type Controller = (?req :: Request) => String
>>
>>controller1 :: Controller
>>controller2 :: Controller
>>
>>controllerList = [controller1, controller2]
>>
>>GHC complains with:
>>
>>    Unbound implicit parameter (?req :: Request)
>>      arising from use of `controller1'
>>    In the list element: controller1
>>    In the definition of `controllerList':
>>        controllerList = [controller1, controller2]
> 
> 
> You have just been bitten by monomorphism restriction. Write a type
> signature for controllerList and it should work:
> 
> controllerList :: (?req :: Request) => [String]
> 
> Best regards,
> Tom




More information about the Glasgow-haskell-users mailing list