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

Implicit lambda arguments #56

Open
clayrat opened this issue Jul 28, 2019 · 2 comments
Open

Implicit lambda arguments #56

clayrat opened this issue Jul 28, 2019 · 2 comments

Comments

@clayrat
Copy link
Contributor

clayrat commented Jul 28, 2019

(This is more of a feature request, but it's been a long-standing stumbling block for me in Idris 1, and I hope it's fairly uncontroversial)

Steps to Reproduce

module Temp

import Data.Vect 

All : (a : i -> Type) -> Type
All a {i} = {j : i} -> a j

Vect' : Type -> Nat -> Type
Vect' = flip Vect 

infixr 1 :->
(:->) : (a, b : i -> Type) -> (i -> Type)
(:->) a b i = a i -> b i

showAll : All (Vect' Integer :-> Vect' String)
showAll = map show

justShowAll : Maybe (All (Vect' Integer :-> Vect' String))
justShowAll = Just ?hole

Expected Behavior

justShowAll = Just $ \{j} => map show

Observed Behavior

There doesn't seem to be a way to introduce the implicit to finish filling the hole.

@edwinb
Copy link
Owner

edwinb commented Jul 28, 2019

Internally, these exist, but there's no syntax yet. There is a possible complication - implicits might appear in a different order than the lambdas, so perhaps there needs to be a way to indicate which implicit argument you mean (in much the same way as you write {n = foo} in a function call) and so it might need to be able to handle lambdas appearing in a different order than in the type.

On the other hand, a simple approach would be to say that if you have an implicit lambda, it needs to be "the next one".

Anyway, all of that is why I've never implemented it. But it would be nice to have.

@clayrat
Copy link
Contributor Author

clayrat commented Jul 28, 2019

Yeah I think going for a simpler solution and assuming a fixed order might be good enough for a start. This is what happens when matching on auto implicits already anyway, right?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants