[web-devel] Odd "Ambiguous type variable `a0' in the constraint:" error (with Yesod)

Mathew de Detrich deteego at gmail.com
Sun May 1 05:50:45 CEST 2011


Ok so I have a problem that was described here (
http://permalink.gmane.org/gmane.comp.lang.haskell.web/1431) in regards to
returning a  "Ambiguous type variable `a0' in the constraint error" when
compiling. Originally I thought it was due to the way I was coding that part
of the code (or to be more accurate the code specifically for creating the
so called widgets with addHTML/addWidget,addHamlet). So I copied the example
code given here exactly (http://www.yesodweb.com/book/example-widgets).

Compiling this worked fine, so at the next point I changed the definition
of getRootR to
getRootR = defaultLayout $ wrapper $ do
    setTitle "Polymorphic Hamlet"
    addHtml [$hamlet|<p>I was added with addHtml|]
    addHamlet [$hamlet|<p>I was added with addHamlet|]
    addWidget [$hamlet|<p>I was added with addWidget|]

and then to
getRootR = defaultLayout $ do
    setTitle "Polymorphic Hamlet"
    addHtml [$hamlet|<p>I was added with addHtml|]
    addHamlet [$hamlet|<p>I was added with addHamlet|]
    addWidget [$hamlet|<p>I was added with addWidget|]

Both times compiled fine, so the issue wasn't what I originally thought that
it was (as described in
http://permalink.gmane.org/gmane.comp.lang.haskell.web/1431). The problem
is, that when I use the above example code in my WebServer, I get this
Ambigious type error when compiling (even though I have set up the route the
exact same way). Unfortunatley I can't provide the code for my webserver,
since its commercially owned (and it would be pointless because its just
renamed variables, but otherwise its the same), so does anyone have any
ideas what could possibly cause such an error (such as a missing/extra
import or some package or something), or possibly some missing instances?

Also sorry for creating another mailing list, but its a different issue then
what I thought it was originally (and I also wanted to put it on
haskell-cafe since its a more general issue)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/web-devel/attachments/20110501/00f02eef/attachment-0001.htm>


More information about the web-devel mailing list