Giter VIP home page Giter VIP logo

Comments (4)

retronym avatar retronym commented on May 10, 2024

Scalaz6 overloads the meaning of Zero a bit: it's both the Zero of the corresponding Monoid (ie, x + 0 = x), and this gets (ab--)used as a default value. Neither of these types forms a Monoid, so it's hard to add a reasonable Zero. It's likely that in Scalaz7 we will separate these better.

For now, I think it's more appropriate to add these to your own project. Just declare the implicits and import them; or declare them in your top level package object to avoid needing an import.

from scalaz.

alexanderdean avatar alexanderdean commented on May 10, 2024

Thanks @retronym, your suggestion sounds very sensible. I've tried adding the following to the package def:

// For ∅[java.util.UUID]
implicit def UUIDZero: Zero[UUID] = zero(null)

But I'm getting could not find implicit value for parameter z: scalaz.Zero[java.util.UUID] errors when I call it - any ideas what I'm doing wrong?

from scalaz.

retronym avatar retronym commented on May 10, 2024

Did you import it at the place you need it?

Try this at the place you want to use it:

(UUIDZero: Zero[UUID])

from scalaz.

alexanderdean avatar alexanderdean commented on May 10, 2024

Thanks @retronym, I didn't import it at the place of use because it's in the package definition. However it doesn't work either if I put the implicit def right next to the calling code :

implicit def UUIDZero: Zero[UUID] = zero(null)
def this() = this(∅[Long], ∅[UUID]) // Still throws error

I didn't understand where I should add the snippet in your last message? (UUIDZero: Zero[UUID] - any ideas much appreciated!

from scalaz.

Related Issues (20)

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.