15:36:02 <sm> hi stepcut, all
15:36:20 <sm> are there any projects using hsp 0.9 I can look at ?
16:05:42 <stepkut`> sm: yes -- clckwrks has been upgraded
16:05:52 <stepkut`> sm: also the example in happstack-foundation
16:06:55 <stepkut`> sm: it's almost exactly like hsp-0.7 except you call hsx2hs
16:07:14 <stepkut`> sm: and there is now a [hsx| <p>quasiquoter</p> |]
16:07:35 <stepkut`> I'm still migrating some code to hsp-0.9 and then I am going to update all the documentation
16:29:13 <sm> stepkut`: thanks. I'm having another go at upgrading darcsden
16:29:27 <sm> 's hsp. Hey, which package provides trhsx/hs2hsx ?
16:29:48 <sm> ahh, hsx
16:29:48 <Clint> sm: http://hackage.haskell.org/package/hsx2hs
16:29:54 <Clint> hsx is deprecated
16:30:01 <sm> ahh ahh
16:33:54 <jonkri> What happened to HSP.Identity?
16:41:36 <sm> I think the name change is a pity. hsx was easier to remember the spelling of
16:46:23 <stepkut`> jonkri: replaced by HSP.Monad
16:46:33 <stepkut`> jonkri: which is like Identity but with a phantom parameter
16:47:02 <stepkut`> there are only two packages now, hsx2hs and hsp, HJScript/HJavascript are still around, but deprecated and no longer required to install hsp
16:47:13 <jonkri> Thanks stepcut`!
16:48:08 <stepkut`> HSP.Monad provides a new HSPT monad transformer -- which is really more like IdentityT, I should consider adding something like, type HSP = HSPT Identity
16:48:15 <stepkut`> just so users don't have to
16:48:47 <stepkut`> sm: I can definitely help out with uprgading darcsden
16:50:07 <jonkri> Where is the evalIdentity equivalent for HSPT?
16:55:30 <stepkut`> unHSPT
16:55:42 <stepkut`> one moment
16:57:54 <sm> stepkut`: great, will get back to it shortly
17:01:22 <stepkut`> hmm. hpaste.org seems to be down :-/
17:02:16 <stepkut`> http://pastebin.com/HJuAzU2B
17:03:04 <Clint> there's http://lpaste.net/new/haskell until hpaste gets fixed or something
17:59:28 <sm> stepkut`: error line numbers seem far off ("error at line 322" with a 100 line file). I don't remember that being a problem, has it always been this way ?
18:00:58 <sm> the file is still <200 lines after the preprocessor
18:02:14 <stepkut`> sm: it has always been that way
18:02:40 <stepkut`> sm: the problem is that hsx2hs currently uses the non-exact parser/printer
18:03:17 <donri> but if the processed file is <200 LOC and the error at line 322, isn't that new and a bug?
18:03:33 <stepkut`> hsx2hs inserts lots of LINE pragmas to try to get the line numbers right -- but the hsx stuff often expands to more lines than were in the original
18:04:07 <stepkut`> using the QQ stuff going forward is the best short term approach
18:04:53 <stepkut`> to fix the preprocessor it needs to be converted to the exact printer/parser which involves calculating the col and line number changes for every new bit of stuff that is inserted
18:07:04 <sm> I hear you, but the LINE pragmas in the generated source only go up to 90
18:07:28 <sm> so it seems odd
18:07:45 <donri> btw, wouldn't it be better if hsp elements contained expressions with no need for <% %> ?
18:07:52 <sm> or I'm just not understanding yet
18:07:58 <sm> anyway, thanks for the confirmation
18:08:10 <donri> you'd have to use string literals when you wanted that
18:11:13 <jonkri> How can I produce a "pure" XML value, without a monad? Earlier, I could do "evalIdentity <xml>", but I don't see how I can do that with unHSPT.
18:14:23 <stepkut`> jonkri: http://pastebin.com/HJuAzU2B
18:14:49 <donri> stepkut`: so it works without the happstack package now?
18:15:53 <stepkut`> donri: the happstack package adds a ToMessage instance and stuff
18:16:10 <stepkut`> donri: this is just an example of getting a pure XML value from HSP
18:16:10 <donri> stepkut`: well it used to be that some happstack package provided the Identity support
18:16:19 <stepkut`> oh yeah
18:16:36 <Clint> stepkut`: you look at reform-hamlet yet?
18:16:44 <sm> stepkut`: I see you're still using trhsx at http://hub.darcs.net/stepcut/clckwrks/browse/clckwrks-theme-basic/Theme/Page.hs ?
18:16:44 <donri> which i think is the only reason hsx-jmacro depends on happstack
18:17:25 <jonkri> stepkut: Thanks again. :-)
18:17:52 <stepkut> clckwrks-theme-basic is obsolete -- replaced by clckwrks-theme-bootstrap
18:18:11 <stepkut> I should move the obsolete theme out of the way
18:18:12 <sm> ah
18:18:31 <donri> next: obsolete bootstrap for http://purecss.io/ ;)
18:18:49 <stepkut> \o/
18:19:10 <sm> so the type of a regular template (xml snippet) in a basic snap app might be.. GenXML Snap ?
18:19:19 <stepkut> I am neither for or against the idea
18:19:48 <donri> how can you resist a css framework that has both "pure" and "IO" in the domain name
18:19:59 <stepkut> sm: hmm, only if there was an XMLGenerator instance for Snap
18:21:04 <sm> stepkut: before, the type was XML. Is there any simple answer to what I should change that to to make it compile ? :)
18:21:38 <sm> I hope I'm not being lazy, I just am finding this rather confusing
18:21:49 <stepkut> sm: I am confused too :)
18:21:58 <stepkut> sm: the XML type still exists..
18:22:18 <sm> oh excuse me. The old type was: HSP XML
18:22:22 <stepkut> ah
18:22:30 <stepkut> that is now, HSPT Identity XML
18:22:31 <sm> and it no longer knows about HSP
18:22:38 <sm> ahh, thanks!
18:22:42 <stepkut> did you see the code in that paste?
18:22:56 <stepkut> http://pastebin.com/HJuAzU2B
18:23:10 <stepkut> I should probably put that alias and helper function in hsp itself
18:23:12 <sm> no, though I've been looking at everything else
18:24:33 <sm> btw in that nice upgrade tutorial you have on school of haskell, it might be worth making the switch to hsx2hs really prominent - if it's required, which I assume it is - it's really easy to miss
18:24:51 <stepkut> hasn't been written yet
18:24:58 <stepkut> still working through some upgrades myself
18:25:12 <sm> nod, you have quite a few eh
18:25:17 <stepkut> should be done with that stuff soon and can do the doc updates
18:25:40 <stepkut> yeah
18:26:10 <stepkut> though at the moment I am building a hexayurt from polyiso :p
18:26:24 <sm> hey fun! :)
18:26:55 <sm> for me it's laundry. I'll apply this knowhow shortly, biab
18:31:34 <jonkri> My JavaScript code in <script> tags seem to have started to cause "Couldn't match type `Char' with `XML'". Is there something I should know about this? The function is of the type "XMLGenT (ServerPartT IO) XML".
18:32:30 <stepcut> jonkri: can you paste the script tag somewhere?
18:32:57 <jonkri> I get the seem error if I don't "return" the String values within <% %> too.
18:34:02 <stepcut> that sounds reasonable..
18:45:56 <jonkri> I need to understand these new types better...
18:46:23 <jonkri> Would it still be reasonable to generate your page with ServerPartT IO XML, through unXMLGenT?
18:48:00 <stepcut> There is no longer a ServerPartT instance for XMLGenerator
18:48:08 <stepcut> let me check something
18:49:06 <stepkut> I think I need to add an Happstack instance for HSPT
18:51:30 <stepkut> and, it seems, an MonadPlus instance for HSPT
18:52:49 <jonkri> Should I go about types differently or should I wait? :-)
18:53:25 <stepkut> one moment
18:53:40 <jonkri> Take your time. :-)
19:11:29 <lpaste> stepcut pasted “using HSPT with Happstack” at http://lpaste.net/91080
19:11:47 <stepkut> I need to upload a new hsp and happstack-hsp real quick before that will work
19:17:24 <jonkri> Ah, okay! Do you have some idea of when that might happen?
19:17:27 <stepkut> uploaded!
19:19:13 <jonkri> Phew! That was fast. :-)
19:21:59 <lpaste> stepcut pasted “HSPT + QQ” at http://lpaste.net/91081
19:22:41 <stepkut> sm, jonkri: here is a way of using the new hsx which preserves comments and hopefully provides better line numbers in error messages, http://lpaste.net/91081
19:22:54 <stepkut> uses a QuasiQuoter, similar to hamlet
19:23:36 <jonkri> stepcut: can you use that qq for several lines of html?
19:24:23 <stepkut> yes
19:33:42 <stepcut> awesome, yes?
19:34:19 <jonkri> I'm trying to get it to work, but I think I'm missing something. :-P
19:34:59 <jonkri> parse error on input `<'
19:35:29 <jonkri> Ah, TemplateHaskell is not enough, I need QuasiQuotes too.
19:39:35 <jonkri> Why was the ServerPartT instance removed?
19:39:48 <jonkri> "type Server = XMLGenT (HSPT XML (ServerPartT IO))" is a little hard to digest. :-P
20:22:01 <jonkri> If I have a function f :: XMLGenT (HSPT XML Identity) XML, and I want to call it from a <% %> block in a quasi-quoting function "XMLGenT (HSPT XML (ServerPartT IO)) XML", how can I do it? I've tried playing around with unHSPT, runIdentity and return, but nothing seems to work...
20:28:13 <sm> stepkut: how would you feel about me uploading my ghc 7.6 compatible hsp 0.7 branch to hackage as 0.7.3 ?
20:52:29 <sm> because I don't seem to have the energy to figure these new types out today
20:52:39 <sm> and I don't think they're fully baked
21:01:59 <stepcut> sm: send me the changes and I will make an upload
21:03:15 <stepcut> jonkri: <% runIdentity . unHSPT . unXMLGenT $ f %> ?
21:05:07 <stepcut> or.. maybe the Identity code polymorphic?
21:05:20 <stepcut> f :: (Monad m) => XMLGenT (HSPT XML m) XML
21:05:20 <stepcut> ?
21:05:48 <stepcut> since the Identity monad doesn't actually do anything you should be able to use the 'f' whether the inner monad is Identity or (ServerPartT IO)
21:07:32 <sm> stepcut: that would be great. It's http://hub.darcs.net/simon/hsp/patch/20130625023615-3c3f9
21:27:01 <jonkri> How do I go from String to XML? I want to call an IO String function from a "XMLGenT (HSPT XML (ServerPartT IO)) XML" <% %> block.
21:36:56 <donri> jonkri: i think it should be enough to do <% liftIO thing %>
21:39:30 <jonkri> donri: With "f :: Maybe String", "liftIO f >>= \m -> return $ fromJust m" gives me an overlapping instances error.
21:40:13 <donri> what's that got to do with what you said before?
21:40:19 <jonkri> (And so does <% liftIO f %>.
21:40:44 <jonkri> Sorry, I meant f :: IO (Maybe String).
21:41:45 <jonkri> It doesn't matter if I define `f = return "test"', I still get that error.
21:44:16 <stepcut> ok
21:44:20 <stepcut> we have these instances:
21:44:21 <stepcut> EmbedAsChild (HSPT XML m) String
21:44:42 <stepcut> well.. just that one I guess
21:44:49 <stepcut> but not one for Maybe values
21:44:59 <donri> didn't we use to?
21:45:04 <stepcut> dunno
21:45:46 <stepcut> I would need to see the code in question really to fix the error
21:46:00 <jonkri> With f :: IO String = return "test", I get the error:
21:46:02 <jonkri> Main.hs:81:18:
21:46:02 <jonkri>     Overlapping instances for EmbedAsChild
21:46:02 <jonkri>                                 (HSPT XML (ServerPartT IO)) (m0 String)
21:46:02 <jonkri>       arising from a use of `asChild'
21:46:47 <jonkri> The type is "XMLGenT (HSPT XML (ServerPartT IO)) XML", and the code is "<% liftIO f %>" in quasi-quoter.
21:46:49 <stepcut> right.. because there it does not know what monad, return "test", should use
21:46:59 <stepcut> oh what
21:47:04 <stepcut> I mean, oh wait
21:47:49 <stepcut> it doesn't know what monad 'liftIO f' should be
21:48:03 <jonkri> Oh...
21:48:13 <jonkri> Why not "XMLGenT (HSPT XML (ServerPartT IO))"?
21:48:22 <stepcut> that would be a choice.. but not the only one
21:48:34 <stepcut> Haskell doesn't just pick one that happens to work
21:48:43 <stepcut> it only picks one when there is unique choice available
21:48:45 <jonkri> That's a good thing, I guess. :-) What would be an alternative?
21:49:05 <stepcut> pretty much any monad that implements MonadIO
21:49:22 <jonkri> Ah, cool.
21:49:34 <stepcut> if you give the expression an explicit type signature it should work I think
21:50:03 <jonkri> It does. :-) And now I've got it all set up, and I'm ready to rock n' roll with this nice library. :-)
21:50:11 <stepcut> though, you may need to also handle the Maybe part
21:50:36 <stepcut> so you'd need the fromMaybe "" version or something
21:51:39 <stepcut> liftIO (f >>= fromMaybe "") :: XMLGenT (HSPT XML (ServerPartT IO)) String
21:51:42 <stepcut> or something like that
21:52:02 <stepcut> usually I define a type alias like, type Server = HSPT XML (ServerPartT IO), so I don't have to keep typing that
21:52:22 <stepcut> or a newtype -- though there is some template haskell code we need to write still to make that work easily
21:52:55 <stepcut> newtype deriving can't handle the associated type stuff so we need some TH to come to the rescue
21:53:17 <jonkri> It does. :-) And now I've got it all set up, and I'm ready to rock n' roll with this nice library. :-)
21:53:21 <jonkri> Oops, sorry.
21:53:31 <jonkri> I see.
21:53:50 <jonkri> Thank you so very much for your help. :-)
21:53:57 <jonkri> And you too, donri. ;-)
21:54:33 <jonkri> With every new thing I learn, I feel the power of Haskell and HSP unleashing. :-)
22:07:00 <sm> darcsden release is ready to roll after hsp 0.7.3
22:08:41 <sm> lunch the missiles! er.. to lunch
22:12:22 <stepcut> sm: k. I'll take a break from hexayurt building and push that through shortly
22:13:06 <jonkri> http://hexayurt.com/ ?
22:13:32 <stepcut> yup
22:13:53 <jonkri> Sounds nice.
22:13:56 <stepcut> I'm making one similar to this, http://i.imgur.com/AbOxJ.jpg
22:15:18 <jonkri> Looks nice... But... To what end?
22:16:59 <jonkri> Nevermind, I've already taken up too much of your time.
22:17:00 <jonkri> :-)
22:31:03 <stepkut> so that I have a nice place to sleep at burning man
22:54:05 <stepkut> sm: uploaded, http://hackage.haskell.org/package/hsp-0.7.3
23:08:11 <sm> stepkut: thank you!
23:16:11 <stepkut> sm: we can figure out how to upgrade to hsp-0.9 another day
23:21:58 <sm> sounds good
23:49:34 <sm> darcsden released, thanks for the help stepcut
23:49:41 <stepcut> sweeet
23:50:58 <jonkri> Good night!
23:51:07 <jonkri> Thanks again.