GithubHelp home page GithubHelp logo

union's Introduction

Union

Build Status Hackage

Extensible type-safe unions.

ghci> let a = openUnion # (5 :: Int) :: OpenUnion '[Bool, Int]

ghci> a ^? openUnion :: Maybe Int
Just 5

ghci> a ^? openUnion :: Maybe Bool
Nothing

ghci> a ^? openUnion :: Maybe Char
<interactive>:8:6:
    No instance for (UElem Char '[] (RIndex Char '[]))
      arising from a use of ‘openUnion’
    In the second argument of ‘(^?)’, namely ‘openUnion’
    In the expression: a ^? openUnion :: Maybe Char
    In an equation for ‘it’: it = a ^? openUnion :: Maybe Char

union's People

Contributors

int-index avatar raehik avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

Forkers

extensibl raehik

union's Issues

Benchmark build failure: duplicate NFData instance for Proxy

/Users/danburton/scratch/union-0.1.1.0/bench/Benchmark.hs:11:10: error:
    Duplicate instance declarations:
      instance forall k (a :: k). NFData (Proxy a)
        -- Defined at bench/Benchmark.hs:11:10
      instance [safe] forall k (a :: k). NFData (Proxy a)
        -- Defined in ‘Control.DeepSeq’

How I reproduced the error:

stack unpack union-0.1.1.0
cd union-0.1.1.0
stack init --resolver nightly-2016-06-08
stack bench

Vinyl 7.0

I'd like to put vinyl 0.7 on Hackage, but union's dependency constraint on vinyl < 0.7 prevents me from doing that. Is it possible to upgrade to relax constraints either upgrade to vinyl 0.7?

Accidentally wrote the same library

This isn't really an issue, but @mckeankylej just pointed out to me that we inadvertently wrote the same library. In particular, your Union is identical to my CoRec and your lens machinery is identical to my optics. (The typeclass in that module should actually redefine rput, rget, etc. as well, but it looks like I got lazy and forgot to add those).

Prisms

vinyl has lenses, so union can have prisms.

Pattern synonyms

U1, U2, U3, U4, ... U16 for Union
OU1, OU2, OU3, OU4, ... OU16 for OpenUnion

Generate via TH, taking the amount as a parameter.

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.