Skip to content
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

ArrowChoice case syntax works for Decidable #6

Open
tomjaguarpaw opened this issue Jan 23, 2020 · 0 comments
Open

ArrowChoice case syntax works for Decidable #6

tomjaguarpaw opened this issue Jan 23, 2020 · 0 comments

Comments

@tomjaguarpaw
Copy link
Owner

I was surprised to observe that ArrowChoice \case syntax[1] works[2] for Decidable even in the absence of any other arrow syntax. We can quite happily write

\case
    [] -> f -< ()
    [x] -> g -< x+1
    x1:x2:xs -> do
        h -< (x1, x2, xs)

to get something of type f [Int] when Decidable f, f :: f (), g :: f Int, h :: f (Int, Int, [Int]). This addresses a problem I observed a while ago about the incomposability of Decidable.

Perhaps I shouldn't surprised that this is possible. It's dual to how the the opposite half of arrow notation (Applicative and <-) supports ApplicativeDo.

[1] Which doesn't actually seem to be supported by arrow notation, sadly
[2] Or rather "would work"

@tomjaguarpaw tomjaguarpaw changed the title ArrowChoice case syntax works for Decidable ArrowChoice case syntax works for Decidable Jan 23, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant