faylang / fay

A proper subset of Haskell that compiles to JavaScript

Home Page:https://github.com/faylang/fay/wiki

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

--strict automatically invokes expressions

opened this issue · comments

Hi,

compiling the following code with --strict Test

module Test where

import FFI

alert :: String -> Fay ()
alert = ffi "alert(%1)"

loader :: Fay ()
loader = do
  alert "Hello Alert!"

generates the alert when the file is being loaded. If instead, you provide a dummy arg:

module Test where

import FFI

alert :: String -> Fay ()
alert = ffi "alert(%1)"

loader :: String -> Fay ()             -- dummy arg
loader _ = do                          -- dummy arg
  alert "Hello Alert!"

the code does not automatically alert. When looking at the stack of the unwanted alert, an anonymous function seems to be called inside the compiled code.

I think this is same as #394

you're right.