[web-devel] ANN: url-generic-0.1: Parse/format generic key/value URLs from record data types.

Christopher Done chrisdone at googlemail.com
Mon Jun 20 10:49:19 CEST 2011


On 20 June 2011 09:54, Vladimir Zlatanov <vlado at dikini.net> wrote:
> expressions possible. For example having a compound page with several
> different posts in it, expressed in the url. This language gives
> control to the user to express exactly what content they want combined
> and how. This power is often under estimated. The scenarios are too
> many to mention.

For example? What's an example of a compound page, expressed in the url?

> In short - the url DSLs this package makes easy to create makes gives
> me a warm fuzzy feeling. You have a beer or a drink of your choice, or
> chocolate, on me if we meet somewhere.

Haha, I'm glad I'm incuding warm fuzzy feelings.

> And a question:
>
> data Event = Event { eventId     :: Maybe Integer -- ^ The event id.
>                    , eventScope  :: Bool          -- ^ Show the scope?
>                    , eventLayout :: Layout        -- ^ Layout for the page.
>                    , eventRec :: Rec
>                    }
> deriving (Data,Typeable,Show)
>
> data Rec = Rec { one :: Int, two :: Int }    deriving (Data,Typeable,Show)
>
> Would it be possible to express the above in a URL? I understand that
> at the moment it is not, but what are your thoughts on how far it
> would be reasonable to push the encoding.

How would you expect that to be represented? I thought a little about
it… it seems like if it was

> data Rec = Rec { one :: Int, two :: Int }    deriving (Data,Typeable,Show)

Then you could represent it as

/event/id/1/one/a/two/b

or

/event/id/1/rec-one/a/rec-two/b

The former could be a problem as it may lead to ambiguities, unless
you decided that sub-types' fields would have precedence?



More information about the web-devel mailing list