Re: [Haskell-cafe] Can I destructive rebind a local variable in haskell?

2009-01-06 Thread Evan Laforge
2009/1/6 Luke Palmer lrpal...@gmail.com: 2009/1/6 Wang, Chunye (NSN - CN/Beijing) chunye.w...@nsn.com Dear haskeller, Can I destructive rebind a local variable like this import System.Directory test filename = do is_dir - doesDirectoryExist filename let filename = if not is_dir

RE: [Haskell-cafe] Can I destructive rebind a local variable in haskell?

2009-01-06 Thread Wang, Chunye (NSN - CN/Beijing)
Hi Evan, You can also reuse the name exactly by using bind+return instead of let: test filename = do is_dir - doesDirectoryExist filename filename - return $ if not is_dir then filename else filename I'm not a huge fan of the prime thing because it's tiny and easy to miss and if you

[Haskell-cafe] Can I destructive rebind a local variable in haskell?

2009-01-05 Thread Wang, Chunye (NSN - CN/Beijing)
Dear haskeller, Can I destructive rebind a local variable like this import System.Directory test filename = do is_dir - doesDirectoryExist filename let filename = if not is_dir then filename else filename putStrLn $ filename ++ filename main = test . in GHCi 6.10.1 on WinXP,

Re: [Haskell-cafe] Can I destructive rebind a local variable in haskell?

2009-01-05 Thread Luke Palmer
2009/1/6 Wang, Chunye (NSN - CN/Beijing) chunye.w...@nsn.com Dear haskeller, Can I destructive rebind a local variable like this import System.Directory test filename = do is_dir - doesDirectoryExist filename let filename = if not is_dir then filename else filename Nope. The

RE: [Haskell-cafe] Can I destructive rebind a local variable in haskell?

2009-01-05 Thread Wang, Chunye (NSN - CN/Beijing)
: [Haskell-cafe] Can I destructive rebind a local variable in haskell? 2009/1/6 Wang, Chunye (NSN - CN/Beijing) chunye.w...@nsn.com Dear haskeller, Can I destructive rebind a local variable like this import System.Directory test filename = do