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.
Command
Description
: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.
Option
Description
+m
Allow multiline commands
+r
Revert top-level expressions after each evaluation
+s
Print timing/memory stats after each evaluation
+t
Print type after evaluation
-<flags>     
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>
ptr>let str1 = "Hello World"
ptr>putStrLn str1
Hello World
ptr>


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

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

References
https://downloads.haskell.org/~ghc/latest/docs/html/users_guide/ghci-set.html


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

×