GithubHelp home page GithubHelp logo

Comments (6)

vrom911 avatar vrom911 commented on May 22, 2024

This is a correct assertion and we expect the solution to respect this test case.

from learn4haskell.

CharlesSchimmel avatar CharlesSchimmel commented on May 22, 2024

Oh no how embarrassing for me. If that's the case, I don't think the prompt for the task makes that clear. The prompt doesn't indicate to return m False if the first term is False instead of lifting the whole function into m, which would differ it from something from liftM2 (&&)

=💣= Task 8*: Before the Final Boss

Edit: I was told that "Oh no how embarrassing for me" could be interpreted sarcastically, I just meant that it's embarrassing to think I knew better than the learning material, and then also be wrong

from learn4haskell.

vrom911 avatar vrom911 commented on May 22, 2024

This is the lifted version of && which is also lazy, so no surprises in how it works. You don't expect False && undefined fail, you expect it to return False, so this is a sane assumption. We already specified the constraint of Monad in the function as well, which is also a hint. We don't want to provide problem solutions in the task description. We can always explain everything in the review if people would have questions about the task.

from learn4haskell.

CharlesSchimmel avatar CharlesSchimmel commented on May 22, 2024

I'm worried that this is confusing as it differs from something like (&&) <$> (Just False) <*> Nothing as well, and communicates the idea that all lifted lazy functions will act that way. I don't know enough to articulate it, but it seems that even though (&&) is lazy on its own, lifted versions still evaluate the context of the second term. Anyway I won't belabor this more, thanks for taking the time to explain, and these exercises were great.

from learn4haskell.

vrom911 avatar vrom911 commented on May 22, 2024

I am not sure what you are trying to prove in here, but your solution (&&) <$> (Just False) <*> Nothing doesn't even use Monad. That means that it just could not be lazy, as laziness is only achievable in here due to Monad. Applicative apriori won't give you that.
Moreover, this is only an exercise. It is not the library that you have to use. If you think that all people are doing a poor job implementing this function not your way, try to open this issue in all the libraries that provide such a function: directory, extra, protolude and many many more!

Here is not the place to push your visions on laziness and strictness as this is the learning material on Monads that we provide.

from learn4haskell.

CharlesSchimmel avatar CharlesSchimmel commented on May 22, 2024

I'm sorry if I came off as adversarial, I am just trying to reconcile what I thought I understood with the explanation you gave. I'm am
barely past total beginner and thought I found something that was overlooked, and trying to help and learn more. I'm just trying to understand why liftM2 (&&) would not be equivalent.

from learn4haskell.

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.