Open luochen1990 opened 6 years ago
@luochen1990
In case you were not aware, IO
is short hand for IO' FFI_C
, and as such IO
is only for use with the C
codegen. For other backends, i.e. JS
, there should be an equivalent IO' FFI_JS
instances.
Thus, what you are experiencing is expected behaviour. However, the error message could be made better, as it is not clear (from the message) why Idris itself is failing.
Jan
@jfdm thanks for your explanation, but the IO
and JS_IO
problem seems not explain everything, consider the following test:
symbols : Stream Char
symbols = cycle (unpack "abc")
symbols2 : Stream Char
symbols2 = cycle ['a', 'b', 'c']
symbols3 : List Char
symbols3 = unpack "abc"
main : IO ()
main = do
print $ take 10 symbols3
when I use symbols3
, it works correctly and the correct js file is generated. and things works well on symbols2
too, but for symbols
it is just not working. it seems weird for me, and I thought there must be something wrong when we use Stream
and unpack
and js codegen
together.
Steps to Reproduce
the file
bug1.idr
:and the command:
Expected Behavior
Compiles successfully.
Observed Behavior
Compiles failed.