Personal tools

Textual Haskell source

From HaskellWiki

(Difference between revisions)
Jump to: navigation, search

Revision as of 19:04, 14 August 2006

Files with a .ths extension can be Textual Haskell Source. Currently you have .hs (source code is the main thing), .lhs (comments are the main thing) and now you have .ths (text is the main thing).

The code: darcs get

1 Example 1

> showHtml :: String -> String
> showHtml search = pure
[title]<% search %> - Hoogle[/title]

Note that in this example I am escaping the code (with > ticks), and the text is just the main bit. I also have which is substituted inline.

2 Example 2

> showList :: FilePath -> [Bool] -> IO String
> showList filename items =
> src <- readFile filename
The length of <% filename %> is <% length src %>
And the booleans are
<%for i = items %> <%if i %>ON<%else%>off<%end if%><%end for%>