Giter Club home page Giter Club logo

Comments (2)

brprice avatar brprice commented on May 25, 2024

In hackworthltd/vonnegut#291, we introduce a kind hole, to classify type holes. We don't do any fancy smart-holes stuff though.

The following is mostly a rehash of Harry's comment above.

The reason we introduce it is to enable type applications to be formed: consider wanting to write foo : List Bool. We start with foo : ?, and must respect the invariant that whatever type we write has kind KType. We would like to refine the hole to be a type application foo : ?1 ?2, but this requires ?1 to have an arrow kind, rather than KType.

Thus we just say type holes have kind holes, which are consistent with any kind, so ?1 ?2 ∈ KHole ~ KType is fine. We can then fill in ?1 = List and ?2 = Bool.

Another choice could be for every type hole to carry its kind in the AST, so we would start foo : ?#KType, and when doing a type application in a hole ?#kt we would require a kind ks and form ?#(ks->kt) ?#ks. The UI could also offer the choice of giving either the head or the arguments, for example in the hole ?#KType, we could hit type app and get given the options

  • [ k ]: ?#(k -> KType) ?#k, where the square brackets denote some sort of "kind inputter"
  • List ?#KType, as List has the right kind. In general either 1 option per well-kinded type in scope, or a dropdown or something
  • ?#(KType -> KType) Bool, and also for Int (Perhaps a dropdown?)
  • ?#((KType -> KType) -> KType) List and also for Maybe (Perhaps part of the previous options)

from primer.

brprice avatar brprice commented on May 25, 2024

Closing as we made the choice to have kind holes (in the sense of one flavor of kind hole which is consistent with all kinds), and implemented it ages ago. I don't think there is anything else to consider here. Feel free to reopen if I am mistaken!

from primer.

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.