[clean-list] Haskell to clean

Peter Peter putchbe@yahoo.com
Sat, 12 Jan 2002 13:58:56 -0800 (PST)


I still have some questions about the conversion
between Haskell and Clean:

1) If HtmlString and HtmlTag are constructors. How do
I have to define these ?
2) In Haskell we find this line:    data HtmlAttr =
HtmlAttr String String
   Is HtmlAttr also a constructor ? Do we actually
need a constructor or can
   we just write ::HtmlAttr :== (String, String)

/* Haskell code */

\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}


/* Clean Code */

:: HtmlElement =  HtmlString String
                | HtmlTag HtmlTagRecord

:: HtmlTagRecord = {
                    markupTag     :: String,
                    markupAttrs   :: [HtmlAttr],
                    markupContent :: Html
                   }

:: HtmlAttr :== (String, String)

:: Html = {
           getHtmlElements :: [HtmlElement]
          }


Thanks in advance


__________________________________________________
Do You Yahoo!?
Send FREE video emails in Yahoo! Mail!
http://promo.yahoo.com/videomail/