[Haskell-cafe] Doubting Haskell

Luke Palmer lrpalmer at gmail.com
Tue Mar 4 06:44:56 EST 2008

On Tue, Mar 4, 2008 at 4:16 AM, Ketil Malde <ketil at malde.org> wrote:
> Paul Johnson <paul at cogito.org.uk> writes:
>  > I'm surprised you found the significant whitespace difficult.
>  I wonder if this has something to do with the editor one uses?  I use
>  Emacs, and just keep hitting TAB, cycling through possible alignments,
>  until things align sensibly.  I haven't really tried, but I can
>  imagine lining things up manually would be more painful, especially
>  if mixing tabs and spaces.

Especially if mixing tabs and spaces indeed.  Haskell does the Python
thing of assuming that a tab is 8 spaces, which IMO is a mistake.  The
sensible thing to do if you have a whitespace-sensitive language that
accepts both spaces in tabs is to make them incomparable to each
other; i.e.

    main = do
    <sp><sp>putStrLn $ "Hello"
    <sp><sp><tab>++ "World"
    -- compiles fine

    main = do
    <sp><sp>putStrLn $ "Hello"
    <tab>++ "World"
    -- error, can't tell how indented '++ "World"' is...


More information about the Haskell-Cafe mailing list