Giter VIP home page Giter VIP logo

fastsum's Introduction

fastsum

This package provides Data.Sum, an open-union type, similar to the Union type that powers the implementation of Oleg Kiselyov's extensible-effects library.

Unlike most open-union implementations, this type is very fast to compile, even when the type-level list of alternatives contains hundreds of entries. Membership queries are constant-time, compiling to a single type-level natural lookup in a closed type family, unlike the traditional encoding of Union, which relies on recursive typeclass lookups. As such, this type lends itself to representing abstract syntax trees or other rich data structures.

GHC 8's support for custom type errors provides readable type errors should membership constraints not be satisfied.

In order to achieve speed, this package makes fewer guarantees about what can be proven given a Member instance. If you require a richer vocabulary to describe the implications of membership, you should use the traditional implementation of open-unions.

Credits

This library is built on the work of Oleg Kiselyov, which was then modified by Allele Dev. It was extracted from Josh Vera's effects library. Rob Rix implemented the ElemIndex type family and the Apply typeclass.

fastsum's People

Contributors

patrickt avatar robrix avatar joshvera avatar michaelxavier avatar proofofkeags avatar

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.