the flag -N2 requires the program to be built with -threaded

I am currently reading an article[1] where the author uses Haskell to explain her idea. The problem is I don't understand Haskell and am not familiar with Haskell concept like MVar, IVar, etc. (I can get the code compile, and have several years programming experiences.) When testing the code, it throws the error messages "the flag -N2 requires the program to be built with -threaded"; however I can't find thread related flag with ghc command by `ghc --help`. How can I fix this problem? Environment I use: Debian stretch/sid, kernel 4.0.0-2-rt-686-pae, GHC version 7.10.3. The code is exactly the same as described in the section 'Nondeterminism with MVars' of article; and the makefile content is all: ghc -O mvar.hs ghc -o mvar mvar.o run: ./execute # while true; do ./mvar +RTS -N2; done clean: rm mvar Thanks [1]. http://composition.al/blog/2013/09/22/some-example-mvar-ivar-and-lvar-progra...

As there are a lot of options, ghc has a `--show-options` flag which shows
them all. The `-threaded` flag is to be passed to ghc.
I think the second command in the `all` block is redundant, as `ghc -O
mvar.hs` should produce a binary named mvar.
This should work:
all:
ghc -O -threaded mvar.hs
Regards,
Sumit
On 23 March 2016 at 10:49, Jung Kim
I am currently reading an article[1] where the author uses Haskell to explain her idea. The problem is I don't understand Haskell and am not familiar with Haskell concept like MVar, IVar, etc. (I can get the code compile, and have several years programming experiences.)
When testing the code, it throws the error messages "the flag -N2 requires the program to be built with -threaded"; however I can't find thread related flag with ghc command by `ghc --help`. How can I fix this problem?
Environment I use: Debian stretch/sid, kernel 4.0.0-2-rt-686-pae, GHC version 7.10.3.
The code is exactly the same as described in the section 'Nondeterminism with MVars' of article; and the makefile content is
all: ghc -O mvar.hs ghc -o mvar mvar.o run: ./execute # while true; do ./mvar +RTS -N2; done clean: rm mvar
Thanks
[1]. http://composition.al/blog/2013/09/22/some-example-mvar-ivar-and-lvar-progra... _______________________________________________ Beginners mailing list Beginners@haskell.org http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners

I changed to the suggested solution and that fixes the problem. Thank
you very much!
On 23 March 2016 at 14:25, Sumit Sahrawat, Maths & Computing, IIT
(BHU)
As there are a lot of options, ghc has a `--show-options` flag which shows them all. The `-threaded` flag is to be passed to ghc. I think the second command in the `all` block is redundant, as `ghc -O mvar.hs` should produce a binary named mvar.
This should work:
all: ghc -O -threaded mvar.hs
Regards, Sumit
On 23 March 2016 at 10:49, Jung Kim
wrote: I am currently reading an article[1] where the author uses Haskell to explain her idea. The problem is I don't understand Haskell and am not familiar with Haskell concept like MVar, IVar, etc. (I can get the code compile, and have several years programming experiences.)
When testing the code, it throws the error messages "the flag -N2 requires the program to be built with -threaded"; however I can't find thread related flag with ghc command by `ghc --help`. How can I fix this problem?
Environment I use: Debian stretch/sid, kernel 4.0.0-2-rt-686-pae, GHC version 7.10.3.
The code is exactly the same as described in the section 'Nondeterminism with MVars' of article; and the makefile content is
all: ghc -O mvar.hs ghc -o mvar mvar.o run: ./execute # while true; do ./mvar +RTS -N2; done clean: rm mvar
Thanks
[1]. http://composition.al/blog/2013/09/22/some-example-mvar-ivar-and-lvar-progra... _______________________________________________ Beginners mailing list Beginners@haskell.org http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners
_______________________________________________ Beginners mailing list Beginners@haskell.org http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners
participants (2)
-
Jung Kim
-
Sumit Sahrawat, Maths & Computing, IIT (BHU)