ghc-mod/CodingStyle
2014-08-12 15:00:56 +09:00

46 lines
1.5 KiB
Plaintext
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

* GHC support
GHC 7.4, 7.6 and 7.8 are supported at this moment. If GHC 7.10 is
released, the support for GHC 7.4 will be discontinued.
* Compiler warnings
All compiler warnings generated by the latest stable GHC with "-Wall"
MUST be eliminated.
* Deceleration style
Try to use "where" instead of "let".
* Error handling
As a general rule of thumb anything that can fail (as in the Monad
method) should get a surrounding catchError with a description of what
the function was trying to do. If a function is trying to do more than
one thing it should probably be split up into multiple seperate
functions anyways.
All uses of the major partial functions (i.e fromJust, fromLeft, head
etc.) should probably be replaced by pattern matching in the do block
(since pattern match failures are very easy to handle with
catchError).
We also have to be careful with anything that uses liftIO since that
might introduce unexpected exceptions. For example parseCabalFile
still uses IOError's for error reporting which would circumvent ErrorT
and make handling that error with MonadError impossible. Stuff like
that should probably be converted to GhcModT or return IO (Either
String SomeThing) instead. It should be pretty easy to write a
function to lift IO (Either e a) into a GhcModT a (where e could be
String, ´GhcModError` or something like that).
* #if
"#if __GLASGOW_HASKELL__" should be used in "Gap.hs" and "Monad.hs"
only. If it is used in another file, it should be moved into
"Gap.hs".