Paul Hudak <[EMAIL PROTECTED]> writes:
> > Carl> I'm afraid this doesn't work. There are two problems:
> > Carl> 1) You need a constructor above:
> > >> h1 (stringToHtml "This is a Header" (H1Args { align = Right}))
> > Carl> or
> > >> H1 { align = Right, html = stringToHtml "This is a Header" }
> Carl> I'm afraid this doesn't work. There are two problems:
> Carl> 1) You need a constructor above:
> >> h1 (stringToHtml "This is a Header" (H1Args { align = Right}))
> Carl> or
> >> H1 { align = Right, html = stringToHtml "This is a Header" }
and Marko replied:
> h1 (stringToHtml "This is a
Carl,
> "Carl" == Carl R Witty <[EMAIL PROTECTED]> writes:
Carl> Paul Hudak <[EMAIL PROTECTED]> writes:
>> One alternative is to use labelled fields. In your example, if Html
>> were an algebraic datatype such as:
>>
>> > data Html = Type1 { align = Align, ... }
>> > | Type2 { al
Paul Hudak <[EMAIL PROTECTED]> writes:
> One alternative is to use labelled fields. In your example, if Html
> were an algebraic datatype such as:
>
> > data Html = Type1 { align = Align, ... }
> > | Type2 { align = Align, ... }
> > | ...
>
> > data Align = Left | Right | C
> I've got a stylistic question about Haskell.
> What's the best way to add optional arguments to a
> embedded DSL?
>
[..]
> --
> (1) Combinators takes a list of attributes.
>Now we have
>
>h1 :: [HtmlAttr] -> Html -> Html
>
>and might
Andy Gill wrote/a ecrit/skrev:
> I've got a stylistic question about Haskell.
> What's the best way to add optional arguments to a
> embedded DSL?
>
> For example, say I've got an library of HTML combinators.
> To represent
>
> This is a Header
>
> you might write
>
> h1 (strin
One alternative is to use labelled fields. In your example, if Html
were an algebraic datatype such as:
> data Html = Type1 { align = Align, ... }
> | Type2 { align = Align, ... }
> | ...
> data Align = Left | Right | Center
then instead of:
> h1 [align "right"] (stringToH
Paul Hudak wrote:
>
> One alternative is to use labelled fields. In your example, if Html
> were an algebraic datatype such as:
>
> > data Html = Type1 { align = Align, ... }
> > | Type2 { align = Align, ... }
> > | ...
>
> > data Align = Left | Right | Center
>
> then ins
I've got a stylistic question about Haskell.
What's the best way to add optional arguments to a
embedded DSL?
For example, say I've got an library of HTML combinators.
To represent
This is a Header
you might write
h1 (stringToHtml "This is a Header")
The types of the functions