Giter VIP home page Giter VIP logo

idris2-newtype-deriving's Introduction

Newtype, Generic Interface Deriving

This package provides sorely-missed deriving for common interfaces like Num for newtypes and newtype-likes, iow single-constructor types. For instance:

import Generics.Newtype
%language ElabReflection

data Raf = MkRaf Double
%runElab derive "Raf"
  [Generic, Eq, Ord, Num, Neg, Abs, Fractional, FromDouble]

data Raff a b = MkRaff a b
%runElab derive "Raff"
  [Generic, Eq, Ord, Num, Neg, Abs, Fractional, FromDouble, Integral]

Your projects using this lib need to depend on sop and elab-util.

Code here is based on the pristine work done by Stefan Hoeck.

This package could be improved by scanning interfaces and generating the implementations programmaticlly but it does not do so currently and the deriving machinery is instead assembled by hand.

Version

This package follows Haskell PVP which is distinct from SEMVER in that when examining 1.2.3, 1.2 is the Major Version rather than 1.

idris2-newtype-deriving's People

Contributors

marcelinevq avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

idris2-newtype-deriving's Issues

Add library to pack's data collection

Hi

I'm not sure whether you are on the Idris discord, so I ask this here.

I like the idea of this library a lot (obviously). Would you mind if I added this to pack's package collection? You can see the current list of packages here.

Cheers

Stefan

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.