Giter Site home page Giter Site logo

glue Rec's about row-types HOT 3 CLOSED

Pitometsu avatar Pitometsu commented on July 23, 2024
glue Rec's

from row-types.

Comments (3)

dwincort avatar dwincort commented on July 23, 2024 1

Are you looking for something like:

type family (l :: *) .* (r :: *) :: * where
  Rec l .* Rec r = Rec (l .+ r)
  x .* y =  TypeError (TL.Text "Tried to .* non-records")

No, I haven't included anything like this in row-types because .+ seemed general enough, and having another operator just for records seemed unnecessary. Do you have a particular use-case in mind?

from row-types.

Pitometsu avatar Pitometsu commented on July 23, 2024

Do you have a particular use-case in mind?

Yes, following steps.
Create alias to record, to use it everywhere.
Now it's expected to have an ability to create type alias to helper record with additional fields without defining intermediate type alias of rows of original type.

from row-types.

dwincort avatar dwincort commented on July 23, 2024

I suppose I can see the usefulness of this — I've definitely made a row-type synonym called FooRow just so I can then define Rec FooRow — but I think it may make things more confusing overall because now different row-types type families will work on different kinds of arguments. That is, other type functions like .\, .!, .-, Extend, etc, all work on row-types themselves, and not on Recs over row-types, and .* won't play nicely with them. One might argue that we should add special Rec versions of all of those type functions too, but I'm not ready to go there (maybe if they were all in a separate module, e.g. Data.Row.Record.TypeFamilies, but still, I'm not sure it's sensible).

For now, I encourage you to use the 3-line .* I suggested above in your own row-types code. If you find that it's actually super-useful and you're using it a lot, maybe we can discuss upstreaming it later.

from row-types.

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.