Git Product home page Git Product logo

Comments (4)

samhh avatar samhh commented on May 30, 2024

Really we want a way to generically traverse over Stream in our recursive datatypes. Unfortunately, because our datatypes are mutually recursive, I think the recursion schemes approach becomes substantially more complex. Not that I've necessarily fully wrapped my head around ordinary recursion schemes. 🙈

Lenses are something else to look at. If we go this route we should probably prefer optics over lens.

from intlc.

samhh avatar samhh commented on May 30, 2024

This came up again in linting for getStream. It's traversal more generally that's a challenge.

from intlc.

samhh avatar samhh commented on May 30, 2024

Came up again in mapTokens which could at least reuse some of the stuff defined for flattening.

from intlc.

samhh avatar samhh commented on May 30, 2024

For better linting output we need to retain source span information
in the AST (#142). A naive implementation might look like this:

type Stream = [(Token, SourceSpan)]

This makes for a relatively small lib/ diff, and all else looks rosy until we contemplate how we write tests. Where now we might write Plaintext "foo", we'd now need to provide source information. And we'd have to do this everywhere in our tests, and it'd be nonsense that we never use anyway.

A similar problem presents when flattening. It's a lossless procedure in which any source information should be thrown away as it's really no longer valid.

This makes the idea of making our AST parameterised, recursion schemes or not, very tempting. In that scenario our tests can continue to target [Token], but our parser output and linting input could be [(Token, SourceSpan)]. Flattening would transform the latter to the former.

Edit: This describes what I want to do: https://www.reddit.com/r/haskell/comments/sxsj4m/what_are_strategies_for_tracking_type_checking/hxu2tsj/

from intlc.

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.