Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to use two let's on the same line?

Tags:

haskell

hugs

I'm using Hugs interpreter and I want to execute the following code (by Haskell 2010 language report):

let x = 1
z = x+y
in z+1

Is it possible only creating a .hs file and loading? Can I do it by command line directly?

like image 708
eightShirt Avatar asked Nov 07 '15 13:11

eightShirt


1 Answers

Even if you cannot enter multi-line statements into hugs in this case it is possible to do it all in one line.

You can use two let ... in ... like this:

let x = 1 in let z = x+y in z + 1

or you can use ; for multiple definitions like this:

let x=1; z=x+y in z + 1
like image 125
Random Dev Avatar answered Sep 21 '22 18:09

Random Dev