[Haskell] offside rule question

Bulat Ziganshin bulatz at HotPOP.com
Mon Jul 18 03:52:40 EDT 2005


Hello Frederik,

Thursday, July 14, 2005, 4:09:02 AM, you wrote:

FE> But I don't understand how what I've written could be ambiguous. If I
FE> am inside a parenthesized expression, then I can't possibly start
FE> another let-clause.

f = let a = (let b=1 in b)
    in a

FE> The fact that the compiler won't acknowledge this
FE> fact ends up causing a lot of my code to be squished up against the
FE> right margin when it seems like it shouldn't have to be.

give us real examples of such code. there is several tricks to do
this. for example:

read_file _ (startFile, correctTotals, receiveBuf, sendBuf) _ (DiskFile old_fi) = do
  whenJustM (tryOpen$ diskName old_fi) $ \file -> do
  whenJustM (rereadFileInfo old_fi file) $ \fi -> do
  correctTotals$  fiSize fi - fiSize old_fi
  ...

parseCmdline cmdline  =  (`mapMaybeM` split ";" cmdline) $ \one_command -> do
  if one_command==[] then do
      putStr aHELP
      return Nothing
    else do
  let options    =  takeWhile (/="--") one_command
      no_configs =  "-cfg-" `elem` options  ||  "--config-" `elem` options
  ...




-- 
Best regards,
 Bulat                            mailto:bulatz at HotPOP.com





More information about the Haskell mailing list