Giter Club home page Giter Club logo

Comments (5)

HeinrichApfelmus avatar HeinrichApfelmus commented on June 14, 2024

That's good point.

The uses of unsafePerformIO in the module PulseLatch0 are both harmless and unnecessary; the only trouble is let-floating, which I have carefully avoided.

In contrast, the use of unsafePerformIO for sharing in the Cached module is more serious, and that's why it also has a NOINLINE pragma.

Still, the ramifications of unsafePerformIO are a little difficult to survey, so I should probably err on the side of caution and add the various flags.

from reactive-banana.

mitchellwrosen avatar mitchellwrosen commented on June 14, 2024

I think this issue could be closed after we determine what to do about this one:

-- | Return a 'Latch' that has a constant value
pureL :: a -> Latch a
pureL a = unsafePerformIO $ Ref.new $ Latch
    { _seenL  = beginning
    , _valueL = a
    , _evalL  = return a
    }

It seems to me that it would be fine for pureL to be inlined, but it might be better to add NOINLINE anyway.

from reactive-banana.

HeinrichApfelmus avatar HeinrichApfelmus commented on June 14, 2024

It seems to me that it would be fine for pureL to be inlined, but it might be better to add NOINLINE anyway.

I agree.

Ideally, for reasons of efficiency, pureL would get its own constructor in Latch, but slapping NOINLINE on this and calling it a day sounds good to me.

from reactive-banana.

mitchellwrosen avatar mitchellwrosen commented on June 14, 2024

@HeinrichApfelmus Interesting, do you mean this?

data Latch a
  = PureL a
  | NotPureL {- what it is now -}

If so, I can make a new ticket to track that.

from reactive-banana.

HeinrichApfelmus avatar HeinrichApfelmus commented on June 14, 2024

do you mean this?

Yes, indeed.

If so, I can make a new ticket to track that.

Yes, please. That said, there are some performance issues with Latch that I need to think carefully about, and I'm not sure if the definition of Latch that you gave will survive. Then again, a constructor for PureL is highly likely.

from reactive-banana.

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.