Giter Club home page Giter Club logo

th-to-exp's Introduction

th-to-exp Build Status

th-to-exp is a package that provides a way to persist data from compile-time to runtime by producing Template Haskell expressions that evaluate to particular values. For example, if you have a value Just 1, then toExp (Just 1) will produce the expression [e| Just 1 |], which can be used in a splice. For a more direct example, here’s what that looks like without the quasiquote notation:

> toExp (Just 1)
AppE (ConE GHC.Base.Just) (LitE (IntegerL 1))

This is done by using a typeclass, ToExp, that can be automatically derived for types that have a Generic instance.

th-to-exp's People

Contributors

lexi-lambda avatar

Stargazers

 avatar Milán Nagy avatar Masashi Fujita avatar YAMAMOTO Yuji avatar

Watchers

YAMAMOTO Yuji avatar  avatar  avatar  avatar

th-to-exp's Issues

This is Language.Haskell.TH.Syntax.Lift

I'm not sure if you were aware of this or not, but the ToExp class is practically identical to the Lift class from Language.Haskell.TH.Syntax, which can be derived with the DeriveLift extension. (It even has a default implementation.)

Build failiure w/ GHC 8.2.1: No instance for ToExp DerivClause

As seen on the Stackage build server:

[1 of 1] Compiling Language.Haskell.TH.ToExp ( library/Language/Haskell/TH/ToExp.hs, dist/build/Language/Haskell/TH/ToExp.o )

library/Language/Haskell/TH/ToExp.hs:90:10: error:
    • No instance for (ToExp DerivClause)
        arising from a use of ‘Language.Haskell.TH.ToExp.$dmtoExp’
    • In the expression: Language.Haskell.TH.ToExp.$dmtoExp @Dec
      In an equation for ‘toExp’:
          toExp = Language.Haskell.TH.ToExp.$dmtoExp @Dec
      In the instance declaration for ‘ToExp Dec’
   |
90 | instance ToExp TH.Dec
   |          ^^^^^^^^^^^^

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.