Comments (6)
This is a correct assertion and we expect the solution to respect this test case.
from learn4haskell.
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 (&&)
Line 616 in 123981d
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.
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.
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.
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.
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)
- Missing tests - Chapter 4, Tasks 3 and 5 HOT 1
- Bug in est/Test/Chapter1.hs ? HOT 3
- Use default main branch
- Unable to open pull request for Chapter 4 HOT 2
- Build dependency happy fails on OSX 10.15.7 HOT 2
- Update GHC to 8.10.4
- [RFC] Create certificate when all Chapters are passed HOT 1
- Chapter 3 knight Monster clarification HOT 2
- Create 2021 Hacktoberfest logo
- Chapter2: takeEven or dropEven? HOT 1
- Odd test output results HOT 4
- Question about a test HOT 2
- Useful to have docker instructions in README.md? HOT 3
- Is this wording about typeclasses correct in Chapter3.hs? HOT 1
- Save @vrom911's and @chshersh's time by including solutions HOT 1
- are my solutions be mentored ? HOT 1
- Error resolving dependencies while make test-chapter1-basic. HOT 10
- Typo in chapter 1: `Add` instead of `add`
- Upgrade to GHC 9.2
- Upgrade to GHC-9.4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from learn4haskell.