Code Monkey home page Code Monkey logo

Comments (6)

garyb avatar garyb commented on July 30, 2024

I take it this is because of Nothing appearing sometimes? It seems like we could tweak the laws to say pred a > succ a where pred a /= Nothing and succ a /= Nothing, or something like that. Or is there more to it than that?

from purescript-enums.

jacereda avatar jacereda commented on July 30, 2024

Yes, any of those would do for writing the checks. Which one is preferable?

from purescript-enums.

garyb avatar garyb commented on July 30, 2024

The current Enum class is pretty weird, since the Maybe cases do only exist to allow for BoundedEnums to satisfy it the laws, but I think yeah, just modifying the laws to account for the presence of Maybe would probably be better than adding a new class.

I can see some benefit in having an UnboundedEnum, so that is is known succ and pred will never return Nothing and unsafePartial $ fromJust can be safely used... but yeah, the instances that exist for it a probably relatively rare... a smaller infinity than the types that can implement the other Enum classes anyway 😄

from purescript-enums.

jacereda avatar jacereda commented on July 30, 2024

Would these be enough then?

-- | - succ a > pred a where succ a /= Nothing
-- | - pred a < succ a where succ a /= Nothing

Isn't the second one redundant?

from purescript-enums.

garyb avatar garyb commented on July 30, 2024

I think where succ a /= Nothing need applying to all the laws for them to hold? Or do you mean the flipped versions of the laws generally are redundant? They probably are because of the Ord requirement.

from purescript-enums.

hdgarrood avatar hdgarrood commented on July 30, 2024

I think this is resolved by #32; please reopen if not.

from purescript-enums.

Related Issues (15)

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.