From: Jason Catena <jason.catena@gmail.com>
To: Fans of the OS Plan 9 from Bell Labs <9fans@9fans.net>
Subject: Re: [9fans] Why does Acme only show text?
Date: Wed, 15 Jul 2009 18:31:06 -0500 [thread overview]
Message-ID: <d50d7d460907151631k3f954fc6qc97810ea9414d841@mail.gmail.com> (raw)
In-Reply-To: <20090715222758.28371a78.eekee57@fastmail.fm>
[-- Attachment #1: Type: text/plain, Size: 1504 bytes --]
Real World Haskell ch4 pp71-72
>> do x <- foo
>> y <- bar
>>
>> the y <- bar must be directly under the x on the previous line or it's a
>> syntax error, and the error you get from GHC is "the last statement of a
do
>> construct must be an expression"
>
> Huh, so this Haskell syntax actually prevents you from indenting something
that would be indented in any other language. Okay...
I didn't read it like this. The x and y must be lined up because they are
both part of the same set of do-statements. If the y line was a standalone
statement, then it could be indented as shown in this code segment. But in
that case there's no need for a do, since the point of do is to order
statements in sequential time.
the following is a complete Haskell program, using do, which passes through
its input file to an output file. The > specifies code lines, other lines
are considered comments. (I hope gmail preserves the spacing.)
Real World Haskell ch4 pp71-72
> import System.Environment (getArgs)
>
> interactWith function inputFile outputFile = do
> input <- readFile inputFile
> writeFile outputFile (function input)
>
> main = mainWith myFunction
> where mainWith function = do
> args <- getArgs
> case args of
> [input,output] -> interactWith function input output
> _ -> putStrLn "error: need exactly two arguments"
Replace id with any function (of the same type)
to process the data.
> myFunction = id
[-- Attachment #2: Type: text/html, Size: 5025 bytes --]
next prev parent reply other threads:[~2009-07-15 23:31 UTC|newest]
Thread overview: 36+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-07-15 1:58 Jason Catena
2009-07-15 4:36 ` Rob Pike
2009-07-15 5:02 ` David Leimbach
2009-07-15 13:11 ` Charles Forsyth
2009-07-16 9:58 ` cej
2009-07-16 10:41 ` mattmobile
2009-07-16 12:11 ` michael block
2009-07-16 12:29 ` cej
2009-07-15 9:25 ` Paul Donnelly
2009-07-15 12:22 ` Ethan Grammatikidis
2009-07-15 15:32 ` cej
2009-07-15 15:44 ` Ethan Grammatikidis
2009-07-15 17:00 ` John Floren
2009-07-15 18:24 ` Francisco J Ballesteros
2009-07-15 18:26 ` Steve Simon
2009-07-15 18:59 ` David Leimbach
2009-07-15 19:07 ` John Floren
2009-07-15 19:27 ` David Leimbach
2009-07-15 20:58 ` Chad Brown
2009-07-15 21:07 ` John Floren
2009-07-15 19:54 ` Jason Catena
2009-07-15 19:59 ` erik quanstrom
2009-07-15 20:05 ` andrey mirtchovski
2009-07-15 20:14 ` Devon H. O'Dell
2009-07-15 20:29 ` Jason Catena
2009-07-15 20:42 ` Noah Evans
2009-07-15 20:51 ` David Leimbach
2009-07-15 21:27 ` Ethan Grammatikidis
2009-07-15 23:31 ` Jason Catena [this message]
2009-07-15 21:07 ` Ethan Grammatikidis
2009-07-15 21:12 ` erik quanstrom
2009-07-15 21:32 ` Ethan Grammatikidis
2009-07-15 20:41 ` Lyndon Nerenberg
2009-07-15 21:00 ` Federico G. Benavento
2009-07-15 21:14 ` David Leimbach
2009-07-16 8:51 ` Paul Donnelly
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=d50d7d460907151631k3f954fc6qc97810ea9414d841@mail.gmail.com \
--to=jason.catena@gmail.com \
--cc=9fans@9fans.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).