Smarter solving

Open
#35 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
5/5
Estimated time
Over a week
Newbie friendliness
35/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Stale
Tech stack
haskell
Domain
compilers

Research direction

Start with the mapVec example in this issue and review the related work in issues #28 and #29. The work is done when the typechecker can infer the recursive call's number argument from vector-size preservation and cons usage, without requiring an explicit succ(_) match.

Written by the indexing model from the issue text.

Description

In our journey to close #28 and #29, there are places where we could be doing better. For example, we fail on the following example:

mapVec(X :: *, Y :: *, { X -> Y }, n :: #, Vec(X, n)) -> Vec(Y, n)
mapVec(_, _, _, _, []) = []
mapVec(_, _, f, _, x ,- xs) = f(x) ,- mapVec(!, !, f, !, xs)

because we can't solve the number argument to the recursive call to mapVec. If we help the typechecker by matching on the number as succ(_) then we can work it out, but this shouldn't be necessary! We know that mapVec preserves vector size, so we should be able to work out from the use of cons that the argument needs to be n - 1

Dominant language
Haskell
Stars
8
Forks
1
PR merge metrics
No merged PRs in 30d

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from Quantinuum/brat

All issues in Quantinuum/brat

Similar issues

More Haskell issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.