placeholders: Placeholders for use while developing Haskell code

[ bsd3, development, library ] [ Propose Tags ] [ Report a vulnerability ]

While working on some Haskell code, it is often useful to work incrementally by inserting undefined as a placeholder for missing code.

This library provides placeholders that produce better messages when evaluated at run-time and also generate compile-time warnings so that they do not get forgotten so easily. For details, see http://github.com/ahammar/placeholders


[Skip to Readme]

Modules

[Index]

Downloads

Maintainer's Corner

Package maintainers

For package maintainers and hackage trustees

Candidates

  • No Candidates
Versions [RSS] 0.1
Dependencies base (>=4 && <5), template-haskell [details]
License BSD-3-Clause
Copyright (c) 2011 Andreas Hammar
Author Andreas Hammar
Maintainer Andreas Hammar <ahammar@gmail.com>
Category Development
Home page http://github.com/ahammar/placeholders
Source repo head: git clone git://github.com/ahammar/placeholders.git
Uploaded by AndreasHammar at 2011-04-29T05:06:32Z
Distributions Arch:0.1, LTSHaskell:0.1, NixOS:0.1, Stackage:0.1
Reverse Dependencies 20 direct, 177 indirect [details]
Downloads 11353 total (13 in the last 30 days)
Rating 2.25 (votes: 2) [estimated by Bayesian average]
Your Rating
  • λ
  • λ
  • λ
Status Docs uploaded by user
Build status unknown [no reports yet]

Readme for placeholders-0.1

[back to package description]

placeholders

While working on some Haskell code, it is often useful to develop incrementally by inserting undefined as a placeholder for missing code.

This approach has a couple of drawbacks.

  • If you have several occurrences of undefined in your code, it can be hard to track down the one reponsible for the error at run-time.

  • It is too easy to forget to replace undefined with the proper code, which might cause unexpected errors.

This library provides placeholders that produce better messages when evaluated at run-time and also generate compile-time warnings so that they do not get forgotten so easily.

example

{-# LANGUAGE TemplateHaskell #-}

import Development.Placeholders

theUltimateAnswer :: Int
theUltimateAnswer = $notImplemented

main = do
    putStrLn "The ultimate answer:"
    print theUltimateAnswer

This will compile with a warning about the unimplemented function:

$ ghc --make Simple.hs
...
Simple.hs:6:21: Unimplemented feature
...

At runtime, an exception will be thrown when the placeholder is evaluated, indicating the location of the placeholder.

$ ./Simple
The ultimate answer:
Simple: PlaceholderExcption "Unimplemented feature at Simple.hs:6:21"

If compiled with the GHC flag -Werror, the warning will get turned into an error and compilation will fail. -Werror can therefore be used to verify that you haven't left any unintended placeholders behind.