Saturday, 30 April 2016

Haskell: Explicit Structuring


Haskell uses indentations to process blocks of code.

For example,
processData x = let a = 10
                    b = 20
                    c = 30
                    d = 40
                 in (a+b+c+d*x)
 
Above expression can be written like below by using {}.
processData x = let { a = 10; b = 20;
                 c = 30; d = 40 }
                 in (a+b+c+d*x)
 
When you use explicit structuring, normal indentations don’t apply. I prefer to use indentations, instead of explicit structuring.
Previous                                                 Next                                                 Home

No comments:

Post a Comment