Giter Site home page Giter Site logo

Comments (3)

jespercockx avatar jespercockx commented on August 22, 2024 1

The problem is that with λ where you don't necessarily get a simple list of all the fields: there can be other patterns or copatterns, and this can be different for each clause. To solve this properly, what we'd need to do is to first construct the case tree (inserting missing cases in the process) and only then check all of the right-hand sides. But this is not what we do currently: we start by typechecking each clause in isolation and only build the case tree after the fact. It's also not clear how we should deal with overlapping clauses if that strategy would be implemented.

See also #2124 and #3054.

from agda.

UlfNorell avatar UlfNorell commented on August 22, 2024

It's the same reason this also fails:

-- ✖ fails
_ : X
_ = λ where
  .p  refl
  .x  it

To type check the p clause you need the x clause to evaluate. Missing clauses are inserted after type checking the given clauses, so leaving it out behaves the same as writing it at the end.

I would be a little hesitant to say that we should postpone checking the p clause until we know the value of the x clause. You have to be very careful if doing that to not introduce cyclic dependencies between the clauses.

from agda.

omelkonian avatar omelkonian commented on August 22, 2024

OK, that makes some sense, it just didn't occur to me that the order of fields matters.
However, this still doesn't explain why the same thing using record is not order-dependent; this seems somewhat inconsistent.

Also, shouldn't the type checker perform checks according to the dependency order of the fields (i.e. perform a topological sort first, then start type-checking individual fields) and whenever an instance field is encountered either search for a term given by the user, or otherwise appeal to instance resolution. Something like that..

from agda.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.