Book Image

Haskell Data Analysis Cookbook

By : Nishant Shukla
Book Image

Haskell Data Analysis Cookbook

By: Nishant Shukla

Overview of this book

Table of Contents (19 chapters)
Haskell Data Analysis Cookbook
About the Author
About the Reviewers

Using the Haskell Runtime System options

The Runtime System (RTS) in Haskell configures special options such as scheduling, profiling, and managing storage for a compiled Haskell program. In order to write multithreaded code, we must specify our own RTS options as outlined in this recipe.

For further reading, the GHC Commentary on the official Haskell Wiki web page has a very detailed explanation of the runtime system available at

How to do it…

Open a terminal, compile a code, and run it using the RTS option. Imagine that our file is named Main.hs, and issue the following commands:

$ ghc -O2 --make Main.hs -threaded -rtsopts 
$ ./Main  +RTS -N2

How it works…

In order to make use of multiple threads, we must compile our code with the threaded and rtsopts flags enabled.

Now that it is compiled with rtsopts, we can run our program with special instructions placed between the +RTS and -RTS flags. If there is a +RTS flag without a –RTS flag, then...