<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Jun 12, 2015 at 9:10 AM, Anupam Jain <span dir="ltr"><<a href="mailto:ajnsit@gmail.com" target="_blank">ajnsit@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Glad you figured it out! The html function accepts Bytestring instead<br>
of Text to be compatible with blaze-html. I will probably add a<br>
htmlText function which supports Text instead and works seamlessly<br>
with Hamlet et all.<br></blockquote><div><br></div><div>Hamlet itself uses blaze-html so I think you should be able to avoid encodings altogether </div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
One minor thing I notices in your code - it converts from Lazy Text -><br>
Strict Text -> Strict ByteString -> Lazy ByteString<br>
If you use encodeUtf8 from Data.Text.Lazy.Encoding, you can go<br>
directly from Lazy ByteString -> Lazy Text.<br>
<br>
-- Anupam<br>
<div><div class="h5"><br>
<br>
On Fri, Jun 12, 2015 at 5:16 PM, Njagi Mwaniki<br>
<<a href="mailto:mwanikibusiness@gmail.com">mwanikibusiness@gmail.com</a>> wrote:<br>
> Never mind. I found a way to make it work here:<br>
> <a href="https://github.com/urbanslug/cats/blob/master/Handler/Home.hs" rel="noreferrer" target="_blank">https://github.com/urbanslug/cats/blob/master/Handler/Home.hs</a><br>
><br>
><br>
> On Friday, 12 June 2015 12:08:44 UTC+3, Njagi Mwaniki wrote:<br>
>><br>
>> Hey, I am trying to use shakesperean templates with this. I just can't get<br>
>> it to work. Even in a quasiqote widget kind of way. What am I doing wrong?<br>
>> or is this not supported at all. I would like to finally use external files<br>
>> for hamlet lucius and julius. I could show you my code but it's just a ball<br>
>> of wool so I won't even bother.<br>
>><br>
>> On Wednesday, 10 June 2015 22:19:06 UTC+3, Anupam wrote:<br>
>>><br>
>>> You are right. The example in the README is meant to be more of a<br>
>>> template which gives you a flavor of what the code looks like. It also<br>
>>> has chunks of code missing (and with ellipses in its place) that would<br>
>>> need to be filled in before it would compile. The code in the<br>
>>> examples/ directory on github has working code examples with cabal<br>
>>> files<br>
>>> (<a href="https://github.com/ajnsit/wai-routes/blob/master/examples/Subsites.hs" rel="noreferrer" target="_blank">https://github.com/ajnsit/wai-routes/blob/master/examples/Subsites.hs</a>).<br>
>>> I am working on improving the documentation, and adding more examples.<br>
>>><br>
>>> To answer your other questions -<br>
>>><br>
>>> 1. I just released v0.7 today. Docs on Hackage are built periodically,<br>
>>> and we should have proper documentation generated soon.<br>
>>><br>
>>> 2. The TH code generates a "resource" for your route which is like an<br>
>>> abstract representation of your route declaration. It can be reused in<br>
>>> other parts of the code. Notably it is useful when you want to<br>
>>> separate the declaration for the Route datatype and the dispatching<br>
>>> code. In your example, since the resource is created but not used or<br>
>>> exported, it generates a warning. For now you can safely ignore it.<br>
>>><br>
>>> 3. "HandlerS sub master" is the type of a handler for a Subsite "sub"<br>
>>> running within a master site "master". Unfortunately that type is not<br>
>>> very easy to work with. "HandlerM" is a Monadic type that provides<br>
>>> easy access to all wai-routes functionality, and can then be converted<br>
>>> to a HandlerS using runHandlerM. When you don't have a subsite, the<br>
>>> type is simply "HandlerM sub master", which is aliased to "Handler<br>
>>> master". That's why in your example, the handlers all have the type<br>
>>> "Handler MyRoute".<br>
>>><br>
>>> 4. "RouteM" is another Monadic type which makes it easy to compose<br>
>>> multiple routes and middleware together to create a final wai<br>
>>> application. This along with "nested routes", and "subsites", helps<br>
>>> you better organise your application.<br>
>>><br>
>>> HTH<br>
>>><br>
>>> -- Anupam<br>
>>><br>
>>><br>
>>><br>
>>> On Wed, Jun 10, 2015 at 8:38 PM, Njagi Mwaniki<br>
>>> <<a href="mailto:mwaniki...@gmail.com">mwaniki...@gmail.com</a>> wrote:<br>
>>> > It could be just me but the example in your README is totally broken.<br>
>>> > It<br>
>>> > needs at least the extensions like QuasiQotes and TemplateHaskell. Also<br>
>>> > where does DB (used in your example) come from?<br>
>>> ><br>
>>> > Anyway using other examples from your README I got a minimal working<br>
>>> > example<br>
>>> > here: <a href="https://gist.github.com/urbanslug/58a584c002f54ad75c02" rel="noreferrer" target="_blank">https://gist.github.com/urbanslug/58a584c002f54ad75c02</a><br>
>>> ><br>
>>> > I have a few questions regarding the types.<br>
>>> ><br>
>>> > * The haddocks on hackage don't work yet, do they?<br>
>>> > * in myRoute L21 I get the warning `Defined but not used:<br>
>>> > ‘resourcesMyRoute’` can you help with that?<br>
>>> > * I'm confused about this type signature "runHandlerM :: HandlerM sub<br>
>>> > master<br>
>>> > () -> HandlerS sub master"<br>
>>> > * What are HandlerM and RouteM and sub and master? They are in many<br>
>>> > type<br>
>>> > signatures and I don't get them.<br>
>>> ><br>
>>> > Thank you.<br>
>>> ><br>
>>> > On Wednesday, 10 June 2015 01:54:33 UTC+3, Anupam wrote:<br>
>>> >><br>
>>> >> Hi all,<br>
>>> >><br>
>>> >> I have just released v0.7 of wai-routes, the typesafe urls framework<br>
>>> >> for wai. After letting the code rot for several months, I finally<br>
>>> >> managed to carve out some time to do a bit of housekeeping. The code<br>
>>> >> now compiles with ghc 7.8 and 7.10, and is compatible with wai-3.0.<br>
>>> >> The dependency on yesod-routes has also been removed, as that package<br>
>>> >> was deprecated, and its code has been folded into wai-routes.<br>
>>> >><br>
>>> >> I also took the opportunity to add a few long pending features -<br>
>>> >> 1. Subsites! Simpler than the corresponding concept in Yesod, though<br>
>>> >> probably less powerful as well. This is still an evolving experimental<br>
>>> >> feature.<br>
>>> >> 2. Ability to get information about the currently executing route,<br>
>>> >> including the Route Attributes (which is exactly the same thing as in<br>
>>> >> Yesod).<br>
>>> >><br>
>>> >> Get it at -<br>
>>> >> [<a href="http://hackage.haskell.org/package/wai-routes" rel="noreferrer" target="_blank">http://hackage.haskell.org/package/wai-routes</a>]<br>
>>> >> [<a href="https://github.com/ajnsit/wai-routes" rel="noreferrer" target="_blank">https://github.com/ajnsit/wai-routes</a>].<br>
>>> >><br>
>>> >> Feedback would be greatly appreciated, especially from people using<br>
>>> >> wai-routes in their projects!<br>
>>> >><br>
>>> >> -- Anupam<br>
>>> ><br>
>>> > --<br>
>>> > You received this message because you are subscribed to the Google<br>
>>> > Groups<br>
>>> > "Yesod Web Framework" group.<br>
>>> > To unsubscribe from this group and stop receiving emails from it, send<br>
>>> > an<br>
>>> > email to <a href="mailto:yesodweb%2Bu...@googlegroups.com">yesodweb+u...@googlegroups.com</a>.<br>
>>> > For more options, visit <a href="https://groups.google.com/d/optout" rel="noreferrer" target="_blank">https://groups.google.com/d/optout</a>.<br>
><br>
> --<br>
> You received this message because you are subscribed to the Google Groups<br>
> "Yesod Web Framework" group.<br>
> To unsubscribe from this group and stop receiving emails from it, send an<br>
> email to <a href="mailto:yesodweb%2Bunsubscribe@googlegroups.com">yesodweb+unsubscribe@googlegroups.com</a>.<br>
> For more options, visit <a href="https://groups.google.com/d/optout" rel="noreferrer" target="_blank">https://groups.google.com/d/optout</a>.<br>
<br>
--<br>
</div></div><span class="">You received this message because you are subscribed to the Google Groups "haskell-wai" group.<br>
To unsubscribe from this group and stop receiving emails from it, send an email to <a href="mailto:haskell-wai%2Bunsubscribe@googlegroups.com">haskell-wai+unsubscribe@googlegroups.com</a>.<br>
To post to this group, send email to <a href="mailto:haskell-wai@googlegroups.com">haskell-wai@googlegroups.com</a>.<br>
</span>To view this discussion on the web visit <a href="https://groups.google.com/d/msgid/haskell-wai/CAKit5aCsbqp_gmhxFzSnKDz8d0eO4tEFRiMgmMcQ0miBusHL8w%40mail.gmail.com" rel="noreferrer" target="_blank">https://groups.google.com/d/msgid/haskell-wai/CAKit5aCsbqp_gmhxFzSnKDz8d0eO4tEFRiMgmMcQ0miBusHL8w%40mail.gmail.com</a>.<br>
<div class="HOEnZb"><div class="h5">For more options, visit <a href="https://groups.google.com/d/optout" rel="noreferrer" target="_blank">https://groups.google.com/d/optout</a>.<br>
</div></div></blockquote></div><br></div></div>