Code Monkey home page Code Monkey logo

Comments (5)

oxalica avatar oxalica commented on June 14, 2024 2

The initial implementation of type system is included in 2022-11-07.
Currently type inference is done in individual files and have no information input. Polymorphism is also not implemented yet. But it already improved the completion experience a lot.

from nil.

LunNova avatar LunNova commented on June 14, 2024

Since 2 is easy and mostly works, if there are cases where it's not sufficient a way to annotate (a comment after the arg?) the correct type could be useful.

I like the idea of for flakes being able to evaluate the flake and its outputs and record the types things had during that evaluation so they're guaranteed to be right. Could even record multiple types when something has different types depending on where it's called. That also sounds really hard.

from nil.

lf- avatar lf- commented on June 14, 2024

An idea I have about this issue is to possibly use type annotations or otherwise say where the things going into some lambda come from, since it will be different in NixOS modules (regrettably).

Like:

# @type callPackage
{ hello, stdenv }: ....

from nil.

oxalica avatar oxalica commented on June 14, 2024

Type schema of flake.nix is implemented since d044c9c. Completion of inputs and known input fields like outPath, modifiedDate work now. But since we don't evaluate flakes yet, their real output cannot be completed.
Screenshot_20230203_032552

Flake output fields also work, but only when a direct Attrset literal is given in the output. If you use other wrappers like flake-utils, it will not work currently.

Screenshot_20230203_032525

from nil.

ModProg avatar ModProg commented on June 14, 2024

Ideally this could be extended to even provide diagnostics.

I thought, one could start with typing all builtins and maybe nixpkgs.lib and then inferring every time there is a guaranteed type conflict, i.e. when someone swaps the arguments of map.

from nil.

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.