Get Even More Visitors To Your Blog, Upgrade To A Business Listing >>

Haskell: :set : Change settings

By using ‘:set’ Command we can change some of the default behaviors of the Haskell Environment.

Following are the commands to change settings.
:set <option> ...
Set options
:seti <option> ...
Set options for interactive evaluation only
:set args <arg> ...
Set the arguments returned by System.getArgs
:set prog <progname>
Set the value returned by System.getProgName
Set the prompt used in GHCi
Set the continuation prompt used in GHCi

:set editor <cmd>
Set the command used for :edit

Following are the various options used by both ‘:set’ ‘:unset’ commands.
Allow multiline commands
Revert top-level expressions after each evaluation
Print timing/memory stats after each evaluation
Print type after evaluation
Most GHC command line flags can also be set here. (eg. -v2, -XFlexibleInstances, etc.)

Change the GHCi prompt
By using ‘:set prompt promptName’ command, you can change the prompt name used in GHCi.
Prelude> :set prompt ptr>
ptr>let str1 = "Hello World"
ptr>putStrLn str1
Hello World

By using various options of :set command, you can add extra information while displaying variables.
ptr>let str1 = "Hello World"
"Hello World"
ptr>:set +t +s
"Hello World"
it :: [Char]
(0.00 secs, 514,752 bytes)

‘:set +t +s’ add type information of the variable,  timing/memory stats of variable after every evaluation.


Previous                                                 Next                                                 Home

This post first appeared on Java Tutorial : Blog To Learn Java Programming, please read the originial post: here

Share the post

Haskell: :set : Change settings


Subscribe to Java Tutorial : Blog To Learn Java Programming

Get updates delivered right to your inbox!

Thank you for your subscription