Code Monkey home page Code Monkey logo

scalacheck-magnolia's Introduction

Scalacheck Magnolia

Generation of arbitrary case classes / ADTs instances with Scalacheck and Magnolia!

Why?

Because scalacheck-shapeless is good but too slow. Also this is much smaller and understandable, thanks to Magnolia!

Install

Just copy the files in src/main/scala to your project. It's 2 files, less than 60 lines in total! And you don't have to care about updating Scalacheck or Magnolia

How to use it?

import scalacheckmagnolia.MagnoliaArbitrary._
import org.scalacheck._

case class Example(a: String, b: Long)

val arbitraryExample = implicitly[Arbitrary[Example]]

println(arbitraryExample.arbitrary.sample.get)

Links

scalacheck-magnolia's People

Contributors

etaty avatar konradwudkowski avatar xuwei-k 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  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

scalacheck-magnolia's Issues

Example in README not working?

Hi @etaty,
thanks for this awesome library! One of my open source projects is heavily based on scalacheck-shapeless: I am rewriting it using scalacheck-magnolia to see if it can benefit from the performance improvements.

However, not even the example shown in the README seems to work:
val arbitraryExample = implicitly[Arbitrary[Example]]
doesn't manage to actually generate an instance of arbitrary.

I have written a test about it, you can have a look here - maybe I forgot some dependency or setting while copying things over....?

Also, do you have any plans to publish this library? I know it is only 2 files, but for maintainers using your library as dependency is not ideal because it would be more difficult to upgrade to a newer version or include any bug fixes.

Cheers,
D.

Release as artefact

It would be nice to be able to include this as a library dependency for a few reasons:

  • Conformity
  • No "invisible" dependency on scalacheck/magnolia
  • No confusion as to where to place files

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.