todo-0.2.0.0: A todo bottom.

Safe HaskellNone
LanguageHaskell2010

Debug.Todo

Description

Todo wraps some standard debug symbols in warnings so that you'll have to work a bit harder to miss unfinished code in your Haskell programs.

For instance, say that you have this line of code:

neatFunction = undefined

undefined is a good stubbing tool but what if you forget what you were stubbing? You'd like to have some more info on what you were doing, so you do this:

neatFunction = error "Got to implement this someday or my boss will get mad"

This may work but there's some issues with it:

  • error is often used for non-total functions, this may confuse the reader
  • If we forget to implement the call for neatFunction, we're not getting noticed that our function currently is incomplete!

Therefore, with Development.Todo you can do this:

neatFunction = todo "I'm going to implement this!"

This will not only solve the cultural ambiguity of error but will also throw a compile time warning so if you're using -Wall in your build step, you will get a warning whenever you forget a todo in your code!

Example:

  $ runhaskell example.hs

  example.hs:5:16: warning: [-Wdeprecations]
      In the use of ‘todo’ (imported from Development.Todo):
      "TODO:s exists in code! Make sure you fix them! "

Synopsis

Documentation

todo :: String -> a Source #

Warning: TODO:s exists in code! Make sure you fix them!

Gives a warning on compile time.

todo_ :: a Source #

Warning: TODO:s exists in code! Make sure you fix them!

Gives a warning on compile time, even if you don't know what to write.

trace :: String -> a -> a Source #

Warning: TODO:s exists in code! Make sure you fix them!

Wrapper for trace from Debug.Trace, with a warning on compile time.