Update:

I deleted all traces of Haskell from my machine and re-installed the Haskell 
Platform.

The latest heist then installed and so I'm back to debugging my code.
Replacing MyMonad [Node] with Splice MyMonad appears to be working (at least 
more of my code is now compiling).

Kevin

--- On Tue, 6/22/10, Kevin Jardine <[email protected]> wrote:

> From: Kevin Jardine <[email protected]>
> Subject: Re: [Snap Framework] renderTemplate with XML fragments in Heist
> To: [email protected]
> Date: Tuesday, June 22, 2010, 3:00 PM
> I tried to install the latest version
> of heist.
> 
> The install failed (something about directory) and
> following that I get the dreaded circular dependency message
> when I try to recompile my application:
> 
> cabal.exe: dependencies conflict: ghc-6.12.1 requires array
> ==0.3.0.1 however
> array-0.3.0.1 was excluded because ghc-6.12.1 requires
> array ==0.3.0.0
> 
> So for now, the entire effort is toast.
> 
> I'm beginning to wonder about Haskell's stability in
> general.
> 
> :(
> 
> Kevin
> 
> --- On Tue, 6/22/10, Kevin Jardine <[email protected]>
> wrote:
> 
> > From: Kevin Jardine <[email protected]>
> > Subject: Re: [Snap Framework] renderTemplate with XML
> fragments in Heist
> > To: [email protected]
> > Date: Tuesday, June 22, 2010, 12:33 PM
> > I'm still floundering but now I'm
> > trying a modified approach:
> > 
> > My own node functions (called by the splice function)
> have
> > been returning
> > 
> > MyMonad [Node]
> > 
> > I'm now recoding them to all return
> > 
> > Splice MyMonad
> > 
> > in case that might work.
> > 
> > Kevin
> > 
> > --- On Tue, 6/22/10, Kevin Jardine <[email protected]>
> > wrote:
> > 
> > > From: Kevin Jardine <[email protected]>
> > > Subject: Re: [Snap Framework] renderTemplate with
> XML
> > fragments in Heist
> > > To: [email protected]
> > > Date: Tuesday, June 22, 2010, 11:00 AM
> > > Sorry for banging on about this.
> > > 
> > > I now have code that returns lists of nodes and
> starts
> > by
> > > running the page shell template with Splice
> functions
> > > handling the rest. So far as I know, this is the
> > "Heist way"
> > > to do things.
> > > 
> > > I am still running into the problem that
> > renderTemplate
> > > returns a byte string and callTemplate returns
> some
> > exotic
> > > complex type.
> > > 
> > > Is there not a public template function that
> returns a
> > list
> > > of nodes?
> > > 
> > > Kevin
> > > 
> > > --- On Thu, 6/17/10, MightyByte <[email protected]>
> > > wrote:
> > > 
> > > > From: MightyByte <[email protected]>
> > > > Subject: Re: [Snap Framework] renderTemplate
> with
> > XML
> > > fragments in Heist
> > > > To: "Kevin Jardine" <[email protected]>
> > > > Cc: [email protected]
> > > > Date: Thursday, June 17, 2010, 6:36 PM
> > > > Yes, that's correct.  Just keep
> > > > in mind that one of our main goals is
> > > > to promote the clean separation between view
> and
> > > business
> > > > logic.
> > > > Heist was intentionally designed to
> discourage
> > > putting
> > > > business logic
> > > > in the templates (views).  This is why we
> > didn't
> > > make
> > > > any kind of loop
> > > > or conditional syntax available in the
> > templates. 
> > > > Similarly we want
> > > > to discourage putting views inside your
> Haskell
> > > code. 
> > > > So while it
> > > > might be easy to make a splice like this:
> > > > 
> > > > myArticle post = do
> > > >   let body = [Element "span" [("class",
> > "author")]
> > > > [Text (getAuthor post)]
> > > >                
> > > >   ,Element "div" [("class", "postbody")]
> > (getBody
> > > > post)
> > > >                
> > > >   ]
> > > >   return [Element "h1" [] [Text (getTitle
> > post)]
> > > >            ,Element
> > > > "div" [("class", "post")] body
> > > >            ]
> > > > 
> > > > ...we discourage this pattern of putting
> view
> > details
> > > in
> > > > your code.
> > > > The preferred approach would be to implement
> this
> > bit
> > > of
> > > > HTML as
> > > > another template that gets each of the
> > individual
> > > pieces of
> > > > data from
> > > > bound splices.
> > > > 
> > > > On Thu, Jun 17, 2010 at 12:13 PM, Kevin
> Jardine
> > <[email protected]>
> > > > wrote:
> > > > > OK, thanks for the encouragement.
> > > > >
> > > > > I was looking at the definition of
> > bindStrings
> > > itself
> > > > and it occurs to me that a trivial variant
> would
> > be:
> > > > >
> > > > > bindNodes pairs ts = foldr add ts
> pairs
> > > > >  where
> > > > >    add (n,v) = bindSplice n (return
> v)
> > > > >
> > > > > So perhaps I'll start with that and
> see
> > where it
> > > takes
> > > > me.
> > > > >
> > > > > That means that I would be rewriting
> my
> > view
> > > system to
> > > > process lists of nodes rather than strings,
> but
> > the
> > > same
> > > > flow structure would remain (at least for
> now).
> > > > >
> > > > > Kevin
> > > > >
> > > > > --- On Thu, 6/17/10, MightyByte <[email protected]>
> > > > wrote:
> > > > >
> > > > >> From: MightyByte <[email protected]>
> > > > >> Subject: Re: [Snap Framework]
> > renderTemplate
> > > with
> > > > XML fragments in Heist
> > > > >> To: "Kevin Jardine" <[email protected]>
> > > > >> Date: Thursday, June 17, 2010, 6:05
> PM
> > > > >> Yes, that is exactly the approach
> we
> > > > >> had in mind.  You could even
> > > > >> eliminate nodeDict as a parameter
> and
> > store
> > > it as
> > > > state in
> > > > >> MyMonad.
> > > > >> But you wouldn't have to do that. 
> You
> > can
> > > > organize it
> > > > >> in whatever way
> > > > >> works best for your application.
> > > > >>
> > > > >> On Thu, Jun 17, 2010 at 12:00 PM,
> Kevin
> > > Jardine
> > > > <[email protected]>
> > > > >> wrote:
> > > > >> > One experiment that I'm
> looking at
> > is
> > > > defining:
> > > > >> >
> > > > >> > klugeSplice ::
> > [(B.ByteString,[Node])]
> > > ->
> > > > Splice
> > > > >> MyMonad
> > > > >> > klugeSplice nodeDict = do
> > > > >> >    input <- getParamNode
> > > > >> >    let name = getName input
> > > > >> >    return $ fromMaybe [Text
> > (B.pack
> > > > "oops")] $
> > > > >> lookup name nodeDict
> > > > >> >
> > > > >> > and passing
> > > > >> >
> > > > >> > (klugeSplice nodeDict) as the
> > first
> > > parameter
> > > > to
> > > > >> bindSplice.
> > > > >> >
> > > > >> > At least that function
> compiles but
> > I'm
> > > > afraid that
> > > > >> I'm still lost in a conceptual sea
> so
> > I'm not
> > > sure
> > > > if this
> > > > >> is anything like the best
> approach.
> > > > >> >
> > > > >> > Kevin
> > > > >> >
> > > > >> > --- On Thu, 6/17/10, Kevin
> Jardine
> > > <[email protected]>
> > > > >> wrote:
> > > > >> >
> > > > >> >> From: Kevin Jardine <[email protected]>
> > > > >> >> Subject: Re: [Snap
> Framework]
> > > > renderTemplate with
> > > > >> XML fragments in Heist
> > > > >> >> To: [email protected]
> > > > >> >> Date: Thursday, June 17,
> 2010,
> > 5:05
> > > PM
> > > > >> >> To explain in more detail,
> I
> > had
> > > > >> >> thought that Heist was a
> > "slave"
> > > > template
> > > > >> library.
> > > > >> >>
> > > > >> >> You hand it some
> attributes
> > (nodes
> > > or
> > > > strings) and
> > > > >> a
> > > > >> >> template name and it hands
> you
> > back
> > > > something
> > > > >> (nodes or a
> > > > >> >> rendered string).
> > > > >> >>
> > > > >> >> Currently, however, it
> seems
> > as
> > > though
> > > > Heist is
> > > > >> the master
> > > > >> >> app and mine ends up being
> the
> > slave
> > > -
> > > > you hand
> > > > >> Heist a page
> > > > >> >> shell and define some
> hooks and
> > it
> > > does
> > > > all the
> > > > >> work and
> > > > >> >> hands you the final
> string.
> > > > >> >>
> > > > >> >> Is that correct?
> > > > >> >>
> > > > >> >> If so, I'm still keen to
> use
> > the
> > > library
> > > > but will
> > > > >> have to
> > > > >> >> rethink how I am doing
> things
> > as the
> > > work
> > > > flow is
> > > > >> in essence
> > > > >> >> in the reverse order of
> what I
> > am
> > > used
> > > > to.
> > > > >> >>
> > > > >> >> Kevin
> > > > >> >>
> > > > >> >> --- On Thu, 6/17/10,
> Kevin
> > Jardine
> > > <[email protected]>
> > > > >> >> wrote:
> > > > >> >>
> > > > >> >> > From: Kevin Jardine
> <[email protected]>
> > > > >> >> > Subject: Re: [Snap
> > Framework]
> > > > renderTemplate
> > > > >> with XML
> > > > >> >> fragments in Heist
> > > > >> >> > To: "MightyByte"
> <[email protected]>
> > > > >> >> > Date: Thursday, June
> 17,
> > 2010,
> > > 4:34
> > > > PM
> > > > >> >> > Thanks for your
> patience
> > here!
> > > > >> >> >
> > > > >> >> > I am still running
> into a
> > > > conceptual
> > > > >> difficulty here
> > > > >> >> as I
> > > > >> >> > want to pass around
> a
> > > > dictionary/map
> > > > >> structure of some
> > > > >> >> kind
> > > > >> >> > of attribute value
> pairs.
> > > > >> >> >
> > > > >> >> > Eg. [(String,
> [Node])] or
> > > > [(String,String)]
> > > > >> which I
> > > > >> >> can
> > > > >> >> > manipulate in my own
> monad
> > and
> > > then
> > > > pass to
> > > > >> Heist when
> > > > >> >> and
> > > > >> >> > if I choose.
> > > > >> >> >
> > > > >> >> > But bindSplice takes
> a
> > > function
> > > > where I would
> > > > >> want a
> > > > >> >> > dictionary.
> > > > >> >> >
> > > > >> >> > I am obviously
> lacking in
> > > > Heist-foo.
> > > > >> >> >
> > > > >> >> > What to do?
> > > > >> >> >
> > > > >> >> > Kevin
> > > > >> >> >
> > > > >> >> > --- On Thu, 6/17/10,
> > > MightyByte
> > > > <[email protected]>
> > > > >> >> > wrote:
> > > > >> >> >
> > > > >> >> > > From:
> MightyByte
> > <[email protected]>
> > > > >> >> > > Subject: Re:
> [Snap
> > > Framework]
> > > > >> renderTemplate with
> > > > >> >> XML
> > > > >> >> > fragments in Heist
> > > > >> >> > > To: "Kevin
> Jardine"
> > <[email protected]>
> > > > >> >> > > Date: Thursday,
> June
> > 17,
> > > 2010,
> > > > 3:55 PM
> > > > >> >> > > Yeah, this was
> our
> > > intent.
> > > > >> >> > > renderTemplate
> is the
> > only
> > > way
> > > > to get
> > > > >> >> > > things out of
> > > TemplateMonad. 
> > > > By using
> > > > >> >> bindSplice as
> > > > >> >> > I
> > > > >> >> > > mentioned
> > > > >> >> > > above, you keep
> your
> > data
> > > is
> > > > structured
> > > > >> nodes
> > > > >> >> when
> > > > >> >> > > possible.
> > > > >> >> > > bindStrings is
> only
> > > intended as
> > > > a
> > > > >> convenient way
> > > > >> >> to
> > > > >> >> > pass
> > > > >> >> > > strings into
> > > > >> >> > > templates.
> > > > >> >> > >
> > > > >> >> > > On Thu, Jun 17,
> 2010
> > at
> > > 9:47
> > > > AM, Kevin
> > > > >> Jardine
> > > > >> >> <[email protected]>
> > > > >> >> > > wrote:
> > > > >> >> > > > Or am I
> making
> > a
> > > > conceptual error
> > > > >> here?
> > > > >> >> > > >
> > > > >> >> > > > Perhaps I
> should
> > be
> > > using
> > > > >> runTemplate to get
> > > > >> >> the
> > > > >> >> > XML
> > > > >> >> > > fragments and
> only
> > use
> > > > renderTemplate at
> > > > >> the very
> > > > >> >> top
> > > > >> >> > > level?
> > > > >> >> > > >
> > > > >> >> > > > This would
> keep
> > the
> > > input
> > > > as
> > > > >> structured
> > > > >> >> nodes
> > > > >> >> > and
> > > > >> >> > > convert to
> > bytestrings
> > > only at
> > > > the last
> > > > >> step.
> > > > >> >> > > >
> > > > >> >> > > > Kevin
> > > > >> >> > > >
> > > > >> >> > > > --- On
> Thu,
> > 6/17/10,
> > > Kevin
> > > > Jardine
> > > > >> <[email protected]>
> > > > >> >> > > wrote:
> > > > >> >> > > >
> > > > >> >> > > >> From:
> Kevin
> > > Jardine
> > > > <[email protected]>
> > > > >> >> > > >>
> Subject:
> > > > renderTemplate with
> > > > >> XML
> > > > >> >> fragments
> > > > >> >> > in
> > > > >> >> > > Heist
> > > > >> >> > > >> To: [email protected]
> > > > >> >> > > >> Date:
> > Thursday,
> > > June
> > > > 17, 2010,
> > > > >> 3:38 PM
> > > > >> >> > > >> If I
> call
> > > > >> >> > > >>
> > > > >> >> > > >>
> > renderTemplate
> > > > (bindStrings
> > > > >> dict
> > > > >> >> > >
> emptyTemplateState)
> > > > >> >> > > >>
> > templateName
> > > > >> >> > > >>
> > > > >> >> > > >> this
> works
> > fine
> > > if the
> > > > dict
> > > > >> values are
> > > > >> >> all
> > > > >> >> > > unstructured
> > > > >> >> > > >> data.
> > > > >> >> > > >>
> > > > >> >> > > >>
> However, if
> > they
> > > are
> > > > XML
> > > > >> structures,
> > > > >> >> the
> > > > >> >> > resulting
> > > > >> >> > > HTML is
> > > > >> >> > > >>
> escaped,
> > > presumably
> > > > because
> > > > >> bindStrings
> > > > >> >> > inserts
> > > > >> >> > > them as Text
> > > > >> >> > > >> nodes.
> > > > >> >> > > >>
> > > > >> >> > > >> What
> > function
> > > instead
> > > > of
> > > > >> bindStrings do
> > > > >> >> I
> > > > >> >> > call to
> > > > >> >> > > insert
> > > > >> >> > > >> XML
> > fragments?
> > > > >> >> > > >>
> > > > >> >> > > >> Kevin
> > > > >> >> > > >>
> > > > >> >> > > >>
> > > > >> >> > > >>
> > > > >> >> > > >>
> > > > >> >> > > >
> > > > >> >> > > >
> > > > >> >> > > >
> > > > >> >> > > >
> > > > >> >>
> > > >
> _______________________________________________
> > > > >> >> > > > Snap
> mailing
> > list
> > > > >> >> > > > [email protected]
> > > > >> >> > > > http://mailman-mail5.webfaction.com/listinfo/snap
> > > > >> >> > > >
> > > > >> >> > >
> > > > >> >> >
> > > > >> >> >
> > > > >> >> >
> > > > >> >> >
> > > > >> >>
> > > > >> >>
> > > > >> >>
> > > > >> >>
> > > > >> >
> > > > >> >
> > > > >> >
> > > > >> >
> > > >
> _______________________________________________
> > > > >> > Snap mailing list
> > > > >> > [email protected]
> > > > >> > http://mailman-mail5.webfaction.com/listinfo/snap
> > > > >> >
> > > > >>
> > > > >
> > > > >
> > > > >
> > > > >
> > _______________________________________________
> > > > > Snap mailing list
> > > > > [email protected]
> > > > > http://mailman-mail5.webfaction.com/listinfo/snap
> > > > >
> > > > 
> > > 
> > > 
> > > 
> > > 
> > 
> > 
> > 
> > 
> 
> 
> 
> 


      
_______________________________________________
Snap mailing list
[email protected]
http://mailman-mail5.webfaction.com/listinfo/snap

Reply via email to