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, the ghci aborts silencely when I executes
"main"
  after compile it into a executable file. 
 
c:\USERS\home\learning_haskell\>testDirectory
testDirectory
C stack overflow in generated code

  I have some code in scheme which works very well 
 
(define (func x)
  (let ((x x))
    x))

    By rebinding a formal variable, we can save naming some varaibles. I
am not good at naming a variable.

    Thank you in advance

Best Regards 
Chunye Wang <chunye.w...@nsn.com> 

 
_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to