"boilerplate" tool released

Previous Topic Next Topic
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view

"boilerplate" tool released

Tseen She
Hello all,

I have just released "boilerplate" to Hackage

boilerplate is a command line tool that generates explicit boilerplate and inserts it into your source code, enclosed in comments that text editors can easily hide from view. Like the way IDEs do it for languages such as Java, C++ and Go.

This is possible by using the ghc api (via my library and tool "hsinspect") to parse type information from the current module and then use that to drive template expansion using source code marker and a simple template language for rules.

As a demo I have created rules for the most common stock classes (Eq, Ord, Show), some language extensions (Functor, Foldable, Traversable) and some popular classes (FFunctor, Aeson's FromJSON / ToJSON), and QuickCheck's Gen (which is not a typeclass!).

My main hope for this little tool is that it will allow entry level teams who are adopting Haskell to stick to the Haskell2010 standards without having to learn advanced language extensions or get into type level programming.

I also hope that more libraries can use this code to produce more portable code! e.g. targeting whole program optimising compilers that only support Haskell2010.

(thanks to SPJ for helping me get over the final hurdle by pointing me to freeKiTyVarsTypeVars . extractHsTyRdrTyVars)

Best regards,
Tseen She

ghc-devs mailing list
[hidden email]