Embedding a persist key into a hamlet template
What's the most idiomatic way of embedding a persist key into a hamlet template? (By persist key I mean a value of type Key a)
So far I have gotten away with: let Right k = fromPersistValue (fromPersistKey id) -- then use k as a Text but I am pretty sure there is a better way that I have just overlooked. On Fri, May 20, 2011 at 9:13 AM, Patrick Palka <patrick@parcs.ath.cx> wrote:
What's the most idiomatic way of embedding a persist key into a hamlet template? (By persist key I mean a value of type Key a)
_______________________________________________ web-devel mailing list web-devel@haskell.org http://www.haskell.org/mailman/listinfo/web-devel
-- -barkmadley sent from an internet enabled device
That's definitely a possible approach. What I've been using recently is toSinglePiece. I say recently because, prior to persistent 0.5, this wasn't much of an issue, since a persist key was just a number. Now that it's actually a PersistValue internally it's a bit more complicated. Michael On Fri, May 20, 2011 at 2:51 AM, Mark Bradley <barkmadley@gmail.com> wrote:
So far I have gotten away with: let Right k = fromPersistValue (fromPersistKey id) -- then use k as a Text
but I am pretty sure there is a better way that I have just overlooked.
On Fri, May 20, 2011 at 9:13 AM, Patrick Palka <patrick@parcs.ath.cx> wrote:
What's the most idiomatic way of embedding a persist key into a hamlet template? (By persist key I mean a value of type Key a)
_______________________________________________ web-devel mailing list web-devel@haskell.org http://www.haskell.org/mailman/listinfo/web-devel
-- -barkmadley sent from an internet enabled device
_______________________________________________ web-devel mailing list web-devel@haskell.org http://www.haskell.org/mailman/listinfo/web-devel
participants (3)
-
Mark Bradley -
Michael Snoyman -
Patrick Palka