14:21:49 <jonkri> Does anyone have any advice for generating errors based on input[type=text] form fields using Happstack? Something involving getDataFn for every field of the page?
15:51:13 <stepkut> jonkri: not quite sure what you are asking for..
15:53:26 <jonkri> stepcut: Basically, I have a form with a quite a lot of fields, and I need to perform validation in my Happstack application.
15:54:22 <donri> jonkri: have you looked at reform?
15:54:41 <jonkri> Ah, no, thanks. :-)
16:04:35 <jonkri> donri: If I can't generate/change the form, would I then be able to use reform only to validate the POST request?
16:05:22 <donri> jonkri: probably not without changing the input "names"/ids
16:05:55 <jonkri> donri: That I can do.
16:06:56 <donri> jonkri: but digestive-functors might be better suited for that type of usage
16:07:06 <stepcut> donri: ?
16:08:00 <donri> stepcut: well the whole point of the reform fork is to couple the view and validation right?
16:09:08 <donri> if you don't let reform generate the view, you don't get the benefits it offers over digestive anyway, but you will have to work within its constraints
16:09:47 <stepkut> oh, I see, the <form> is in some other HTML somewhere and the question is how to validate it given that the form already exists
16:10:13 <stepkut> still, digestive-functors does not give you direct control over the field names either does it ?
16:10:25 <donri> i think it does
16:11:19 <donri> https://github.com/jaspervdj/digestive-functors/blob/master/examples/happstack.hs#L18
16:11:33 <donri> just don't write the view
16:11:35 <donri> actually...
16:11:40 <donri> jonkri: scratch all that
16:12:00 <stepkut> donri: yes, but are those labels actually used for the field names?
16:12:04 <stepkut> donri: or just internally?
16:12:06 <donri> jonkri: neither reform nor digestive will help you much to put the errors inside the form unless they get to generate the form itself
16:12:25 <donri> stepkut: don't know for sure, but i think they're the name/id fields
16:12:31 <jonkri> donri: Right now I'm thinking that I'm kind of okay with a list outside the form with the errors.
16:13:05 <stepkut> jonkri: if you use getDataFn and the Applicative instance for RqData then you can get all the field values with errors
16:13:15 <stepkut> sort of
16:13:25 <Clint> stepkut: can you advise on 1) how i'd make a requireAuth function 2) only allow certain people to make accounts with happstack-authenticate?
16:15:24 <jonkri> stepcut: Okay, thanks.
16:15:29 <jonkri> Thanks to both of you.
16:15:49 <donri> stepkut: what about http://hackage.haskell.org/packages/archive/reform-blaze/0.2.0/doc/html/Text-Reform-Blaze-Text.html#g:6
16:17:15 <stepkut> Clint: requireAuth is basically just, getUserId, which returns a Maybe UserId
16:17:39 <stepkut> Clint: you can also do, query (HasRole uid role), if you want to only allow people with a certain role to perform the action
16:17:45 <stepkut> though Roles are pretty limited at the moment
16:18:16 <Clint> stepkut: i'm trying to reduce repeated case mUserId of blocks
16:18:30 <donri> jonkri: i think you could write a view with digestive-functors that only lists the errors...
16:18:41 <stepkut> Clint: in clckwrks we have something like this, http://hub.darcs.net/stepcut/clckwrks-dev/browse/clckwrks/Clckwrks/Monad.hs#591
16:18:47 <donri> jonkri: reform has the same function it seems but it would add the form inputs automatically i think
16:19:08 <stepkut> Clint: which is used here, http://hub.darcs.net/stepcut/clckwrks-dev/browse/clckwrks/Clckwrks/Route.hs#22
16:19:28 <stepkut> Clint: which, in turn, is used here, http://hub.darcs.net/stepcut/clckwrks-dev/browse/clckwrks/Clckwrks/Route.hs#36
16:19:38 <Clint> stepkut: okay, thanks, that looks like the type of type i want
16:20:00 <stepkut> Clint: as for limiting only certain people to make accounts -- how would you know who those people are?
16:20:18 <Clint> i'd give them a token or whitelist them somehow
16:21:03 <stepkut> that feature does not exist yet.. though it would be nice if it did
16:22:00 <stepkut> you could either add it properly, or hack something up
16:22:08 <stepkut> the hack something up solution is pretty straight forward I think
16:22:22 <stepkut> to create an account you have to be able to access certain URLs
16:22:49 <stepkut> so you could add a guard that only allowed people to access those URLs if they were in your whitelist
16:23:20 <Clint> ACTION nods.
16:23:34 <stepkut> that could all be done with out changing happstack-authenticate at all
16:24:26 <donri> put a basic auth on the register page? :)
16:25:24 <Clint> oh, that reminds me
16:26:07 <Clint> i'm doing the auth urls with boomerang and readshow; is there a saner way to not enumerate them by hand?
16:27:15 <stepkut> use the existing PathInfo instances for the AuthProfileURL ?
16:34:20 <Clint> how do i incorporate that into a PrinterParser?
16:36:20 <donri> yeah we still need pathinfo integration for boomerang
16:36:32 <donri> and vice versa, possibly
16:36:56 <donri> or if they could be made to use a shared type or class?
16:45:51 <kxra> stepkut: is there doc on happstack foundation somewhere?
16:47:29 <stepkut> kxra: so far only the haddock docs and the very long youtube video I'm afraid
16:47:39 <stepkut> kxra: and the example app
16:49:03 <stepkut> you can use boomerang routes with PathInfo by using boomerangFromPathSegments and boomerangToPathSegments
16:49:35 <stepkut> probably need the inverse as well
16:51:40 <kxra> stepkut: where's the video?
16:51:52 <kxra> this? https://www.youtube.com/watch?v=7Wmszk4wZxQ
16:54:27 <stepkut> yup
16:54:47 <stepkut> it's slightly out of date, but not in any especially interesting ways
16:55:34 <kxra> k, thanks
16:55:40 <stepkut> that tutorial assumes you have never used the acid-state, hsp, reform, etc
16:56:22 <stepkut> if you have already used all that stuff, then you could probably just look at the source and figure it out faster, http://hub.darcs.net/stepcut/happstack/browse/happstack-foundation/examples/ControlV/Main.hs
16:56:42 <stepkut> it's commented and everything :)
16:59:04 <kxra> stepkut: that tutorial sounds perfect
16:59:08 <kxra> the video tutorial you mean?
16:59:16 <kxra> yeah i haven't used anything, remember? xD
17:03:21 <stepkut> kxra: in that case, watch the video!
17:03:38 <kxra> [= thanks
17:03:43 <stepkut> kxra: it's 2 hours long or something silly, but only because it is so detailed :)
17:04:42 <stepkut> donri: the shared class could be PathInfo..
17:08:10 <kxra> stepkut: that sounds great
17:08:22 <kxra> maybe if i can understand it well enough, i can turn it into a text guide
17:09:39 <stepkut> oo
17:09:48 <stepkut> if you do, use pandoc compatible markdown
17:09:57 <stepkut> so I can stick it in the crash course
17:29:50 <kxra> hah, k
17:44:51 <jonkri> What would be a good way of performing something like 10 RqData "look"s, and validations, in one function? I'd rather not have a lot of nested case statements, which is the best that I can think of right now. :-P
17:58:25 <kxra> stepkut: cabal install happstack foundation fails with this package
17:58:27 <kxra> http://pastebin.ca/2431912
18:11:16 <donri> kxra: you need ~/.cabal/bin in $PATH
18:20:53 <kxra> donri: i have a .bashrc and a .bash_profile
18:20:58 <kxra> the latter already specifies one path
18:21:06 <kxra> what is what
18:22:02 <donri> kxra: in .bashrc export PATH=~/.cabal/bin:$PATH
18:22:13 <Clint> kxra: are you on debian?
18:22:32 <kxra> Clint: fedora
18:22:51 <Clint> nevermind then
18:23:15 <kxra> donri: ok. that should work but i'm curious about what i would do if there was already one specified. doesn't matter i guess though
18:25:10 <donri> kxra: you append or prepend to it either like i did or directly
18:25:18 <jonkri> kxra: I'm on Fedora. Let me check.
18:25:23 <donri> just need to separate paths with colon
18:26:05 <bergmark> echo ". ~/.bash_profile" > ~/.bashrc :)
18:26:25 <jonkri> kxra: In ~/.bash_profile, you probably have a line saying "PATH=$HOME/.local/bin:$HOME/bin:$PATH". I have changed that to "PATH=$HOME/.cabal/bin:$HOME/.local/bin:$HOME/bin:$PATH".
18:26:59 <kxra> jonkri: thanks that's what i was looking for
18:27:01 <jonkri> kxra: After that, run "source ~/.bash_profile", and it should work.
18:27:14 <kxra> the meaning of the :
18:27:29 <jonkri> kxra: The colon is the path separator.
18:28:04 <bergmark> paths to the left have precedence
18:28:05 <kxra> yeah, i got it now, heh
18:28:12 <kxra> bergmark: makes sense
18:28:22 <kxra> seems that neither the export nor source commands work with fish
18:29:00 <Clint> fish is indeed not bash
18:29:12 <kxra> yeah i'm configuring my fish profile too
18:29:13 <bergmark> in fish it's
18:29:13 <bergmark> set PATH ~/.cabal/bin $PATH
18:29:18 <kxra> ah thanks
18:31:59 <donri> set -x is export and source is . (but it's source in HEAD)
18:32:43 <kxra> okay, so the path seems to be set
18:32:46 <kxra> echo $PATH
18:32:56 <kxra> shows the right path
18:33:05 <kxra> but the install fails in the same place
18:33:15 <bergmark> reminds me haven't updated fish in quite a while
18:33:27 <bergmark> 4 months!!
18:33:33 <Clint> kxra: do you have hsx2hs in ~/.cabal/bin ?
18:34:49 <kxra> Clint: ah, let me try installing that. I'm still not used to some dependencies not being automatically installed
18:35:04 <bergmark> hmm i don't set -x my PATH
18:37:06 <kxra> why does cabal have so many issues with dependencies like that?
18:37:38 <Clint> because it's not a package manager
18:39:06 <donri> bergmark: it's already set -x
18:39:28 <kxra> ah.
20:42:50 <donri> haskell-suite is shaping up... looks like haskell-names could be used to fix the fixity problem in hsp
22:43:03 <bergmark> yeah :) i need to play with it more
22:43:17 <bergmark> also nice that niklas moved hse to the github org