Differences

This shows you the differences between two versions of the page.

Link to this comparison view

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.
 +
  
/srv/dokuwiki/currywiki/data/pages/documentation/style_guide.txt ยท Last modified: 2019-10-22 09:15 by mh
Back to top
CC Attribution-Noncommercial-Share Alike 4.0 International
Driven by DokuWiki Recent changes RSS feed Valid CSS Valid XHTML 1.0