Differences
This shows you the differences between two versions of the page.
Next revision Both sides next revision | |||
documentation:style_guide [2017-02-24 13:21] mh created |
documentation:style_guide [2017-02-24 15:57] mh |
||
---|---|---|---|
Line 22: | Line 22: | ||
It should be noted that these tools checks only a small part of | It should be noted that these tools checks only a small part of | ||
the style rules (mainly indentation rules). | the style rules (mainly indentation rules). | ||
+ | |||
+ | For instance, consider the following ugly Curry program: | ||
+ | |||
+ | module Test where | ||
+ | | ||
+ | fib n | n==0 = 0 | ||
+ | | n==1 = 1 | ||
+ | | otherwise = fib (n-1) + fib (n-2) | ||
+ | | ||
+ | fac n = if n==0 then 1 | ||
+ | else n * fac (n-1) | ||
+ | | ||
+ | echo = getChar >>= \c -> if ord c == (-1) then done else putChar c >> echo | ||
+ | |||
+ | Then the Curry style checker produces the following style violations: | ||
+ | |||
+ | > curry style Test | ||
+ | ... | ||
+ | Line 3.7 GuardedRhs: Bars are not aligned. | ||
+ | Line 3.19 GuardedRhs: Equality signs are not aligned. | ||
+ | Line 7.9 IfThenElse: Wrong indentation of keywords. | ||
+ | Line 10.0 Line is longer than 80 characters. | ||
+ | Line 10.26 IfThenElse: Wrong indentation of subexpressions. | ||
+ | |||