-
Notifications
You must be signed in to change notification settings - Fork 311
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
monad law (<*>) = ap
is ignored?
#58
Comments
The law holds provided (a) you only look at the results of So Haxl stretches the law a bit, but doesn't break it. |
I have updated code snippets to match ones from your slides and in that example (when performing side effective actions) it ignores that law. Is it common to obey laws for partial input like this in haskell? |
I don't fully understand the question. Perhaps if you give me a specific example of what you mean by partial input? |
You said that Haxl is lawful if "your data sources satisfy the property that fetching in parallel gives the same result" so it's not lawful for all other possible use cases of Haxl(is partially lawful), for example for this fragment of Haxl it's not lawful as run $ do -- 1
cmd "touch" ["foo"]
cmd "rm" ["foo"]
run $ do -- 2
_ <- cmd "touch" ["foo"]
cmd "rm" ["foo"] |
Right - the It's still possible to use Haxl under these conditions, but you have to know what you're doing. Be aware of when |
I have taken look at some talks of @simonmar about haxl:
And looks like Haxl is not lawful as it's ignoring law
(<*>) = ap
.also as
(>>) = (*>)
is implied by that law it causes issues like one in first link (1.) about sequencing monadic actions in do even when applicative do was off:And there was need to add
_ <-
in order that to be sequential:My question are:
Also I have taken look at the original paper about Applicative and did get reasons why this law was intorduced, so if you know any discussion on that topic you can link would be great!
Also in js community some implementations of Futures also Ignore that law (fantasy-land#179), looks like this law is not that widely known.
The text was updated successfully, but these errors were encountered: