[Haskell-beginners] literate programming
Brandon Allbery
allbery.b at gmail.com
Sun Sep 2 01:35:59 CEST 2012
On Sat, Sep 1, 2012 at 6:46 PM, Dennis Raddle <dennis.raddle at gmail.com>wrote:
> Does literate programming in haskell (.lhs) support the idea in Knuth's
> WEB of using aliases for blocks of code? In other words doing something like
>
> main = do
> <part 1>
> <part 2>
>
> <part 1> === putStrLn "foo"
> <part 2> === putStrLn "bar"
>
> (except I don't know what the actual syntax is)
No, and it's not as necessary in Haskell as it was in Pascal because it's
easier (and preferred) to break programs up into smaller functions anyway.
So your <part 1> is just part1, and the definition of part1 follows later.
(Consider that we don't throw around state in variables quite as wontonly;
and when we *do* need to, we can stuff it in a state monad.)
--
brandon s allbery allbery.b at gmail.com
wandering unix systems administrator (available) (412) 475-9364 vm/sms
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/beginners/attachments/20120901/b07c774f/attachment.htm>
More information about the Beginners
mailing list