faylang / fay

A proper subset of Haskell that compiles to JavaScript
https://github.com/faylang/fay/wiki
BSD 3-Clause "New" or "Revised" License
1.29k stars 86 forks source link

Automatic translation of Fay actions without arguments immediately calls the function #394

Open bergmark opened 10 years ago

bergmark commented 10 years ago

This is probably mostly an issue with the strictness wrapper, if you have a declaration

module Foo where
f :: Fay ()
f = putStrLn "boo"

and compile with --strict Foo, f will be called immediately and the value will be cached. For the strictness wrapper this can be fixed by changing their code generation to use the actual type signature, but generally it might be harder to solve. So for now you should not use functions with a type signature Automatic f.

This is usually not a problem, normally you will have a less general type signature, then it works as expected.