this is a re-post of my original question that I asked on the yesod mailing list (please see http://groups.google.com/group/yesodweb/browse_thread/thread/934c4141fc615cb) in an attempt to get a faster response.
I am trying to figure out whether it is possible to generate a <link>
with the type
attribute that corresponds to the MIME type sent by the HTTP handler that serves the favicon file.
so far I have this link:
and this handler:
<link rel="icon" href=@{FaviconR} sizes="32x32" type="image/png">
I am looking for a way to make sure that the code compiles only if
getFaviconR :: Handler ()
getFaviconR = sendFile "image/png" "config/favicon.png"
getFaviconR
and <link>
have the same MIME type.
I realize of course that I can omit type
attribute from the link altogether and rely on the client to figure out the type, but think of it as a theoretical question.
I am new to Haskell, so may be I am asking for something impossible. no?
I think the easiest thing to do here is to define the image type in a separate variable and use it in both places.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With