Difference between revisions of "FP Laboratory 1"
Jump to navigation
Jump to search
Line 13: | Line 13: | ||
</syntaxhighlight > | </syntaxhighlight > | ||
<translate> | <translate> | ||
− | *If you write expression, for example <code>1+2*3</code>, it should be evaluated. You can close this interpreter by typing<code>:q</code>. | + | *If you write expression, for example <code>1+2*3</code>, it should be evaluated. You can close this interpreter by typing <code>:q</code>. |
− | + | *Open Visual Studio Code, create a file <code>simple.hs</code> and put there following lines of code: | |
− | + | </translate> | |
<syntaxhighlight lang="Haskell" > | <syntaxhighlight lang="Haskell" > | ||
− | + | doubleMe x = x * x | |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | + | plus x y = x + y | |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
</syntaxhighlight > | </syntaxhighlight > | ||
− | < | + | <translate> |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
</translate> | </translate> |
Revision as of 12:14, 28 August 2019
Working environment
Using the installation guide from Functional programming prepare your working environment.
How to verify it is working?
- Run
ghci
from the command line. it will start GHC Interpreter, the output should be something like this:
GHCi, version 8.6.5: http://www.haskell.org/ghc/ :? for help
Prelude>
- If you write expression, for example
1+2*3
, it should be evaluated. You can close this interpreter by typing:q
. - Open Visual Studio Code, create a file
simple.hs
and put there following lines of code:
doubleMe x = x * x
plus x y = x + y