diff --git a/CodingStyle b/CodingStyle new file mode 100644 index 0000000..8d008f5 --- /dev/null +++ b/CodingStyle @@ -0,0 +1,45 @@ +* 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".