The placeholders package

[Tags: bsd3, library]

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]

Properties

Version0.1
Change logNone available
Dependenciesbase (==4.*), template-haskell [details]
LicenseBSD3
Copyright(c) 2011 Andreas Hammar
AuthorAndreas Hammar
MaintainerAndreas Hammar <ahammar@gmail.com>
CategoryDevelopment
Home pagehttp://github.com/ahammar/placeholders
Source repositoryhead: git clone git://github.com/ahammar/placeholders.git
UploadedFri Apr 29 05:06:32 UTC 2011 by AndreasHammar
DistributionsLTSHaskell:0.1, NixOS:0.1, Stackage:0.1
Downloads3329 total (256 in last 30 days)
Votes
0 []
StatusDocs uploaded by user
Build status unknown [no reports yet]

Modules

[Index]

Downloads

Maintainers' corner

For package maintainers and hackage trustees

Readme for placeholders-0.1

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.

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.