[clean-list] Haskell To Clean
Peter Peter
putchbe@yahoo.com
Tue, 8 Jan 2002 11:05:15 -0800 (PST)
I'm trying to convert some Haskell code to Clean.
Can anyone assist me with this because I'm new to
functional programming ?
You can find the complete Haskell code at URL:
http://www.cse.ogi.edu/~andy/html/Html.lhs
Haskell code to translate to Clean:
\begin{code}
data HtmlElement
{-
- ..just..plain..normal..text... but using ©
and &amb;, etc.
-}
= HtmlString String
{-
- <thetag {..attrs..}> ..content.. </thetag>
-}
| HtmlTag { -- tag with
internal markup
markupTag :: String,
markupAttrs :: [HtmlAttr],
markupContent :: Html
}
{- These are the index-value pairs.
- The empty string is a synonym for tags with no
arguments.
- (not strictly HTML, but anyway).
-}
\end{code}
\begin{code}
data HtmlAttr = HtmlAttr String String
\end{code}
\begin{code}
newtype Html = Html { getHtmlElements :: [HtmlElement]
}
\end{code}
My interpretation of this coding in Clean:
:: HtmlString :== String
:: HtmlElement = HtmlString
| HtmlTag
:: HtmlTag = {
markupTag :: String,
markupAttrs :: [HtmlAttr],
markupContent :: Html
}
:: HtmlAttr :== (String, String)
:: Html = {
getHtmlElements :: [HtmlElement]
}
Is this correct ? Can anyone adapt this code ?
Thank you.
Best regards,
Sally
__________________________________________________
Do You Yahoo!?
Send your FREE holiday greetings online!
http://greetings.yahoo.com