Git Product home page Git Product logo

th-module-data's Introduction

Build Status

About

th-module-data is a library to allow template haskell authors to store state in a data log which can span multiple modules. In order to accomplish this, it outputs data files which mirror the haskell modules in which the relevant template haskell code is called. th-module-data came about as the result of this thread on the libraries mailing list.

Using it

The Env module provides the highest level interface, exporting a few TH functions which generate envGet_<namespace> and envPut_<namespace> functions. These function add an environment to the Q monad which can be used to store types or kinds or whatever else you might wish for.

The DataLog module provides a slightly lower level interface, allowing you to directly append to a log (represented with a Vector).

In order to properly import all the modules you depend on it is required to call dataLogInit_<namespace> before any of the other functions are invoked. Fortunatly, this funciton is idempotent, so you can call it as many times as you want without being worried that it might trample on any state. All the work is done the first time, and after that it just immediatly aborts.

The code itself has haddock comments, which are a good place to look for more information.

Unresolved Issues

If there is a way to add rm -rf .stack-work/th-module-data to the stack clean command, the README should recomend doing that. I should add simmilar advice for cabal.

Efficent append? Mutable vectors? Should I just give up and use a list?

What is the right name for all these modules? Language.Haskell.TH.DataLog, Language.Haskell.TH.Env, and Language.Haskell.TH.File? The last one at least seems a little presumptuous.

th-module-data's People

Watchers

 avatar  avatar

th-module-data's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.