haskell-beam / beam

A type-safe, non-TH Haskell SQL library and ORM
https://haskell-beam.github.io/beam/
577 stars 170 forks source link

New scoping system #719

Open Ericson2314 opened 1 month ago

Ericson2314 commented 1 month ago

QBaseScope et al were put in place because of limitations of the Haskell type system at the time. It's likely we can get rid of this. In fact, we should probably rethink the entire scoping system in light of new GHC features, and be willing to break compatibility.

Originally posted by @tathougies in https://github.com/haskell-beam/beam/issues/652#issuecomment-1439431041

What would this look like? More data kinds? Something more radical?

tathougies commented 1 month ago

Oh gosh I'd have to really go back and think about this. I believe the main issue is that we ought to be able to keep the 'base' scope as an existential, but for whatever reason, when I first wrote beam, the compiler was unable to match existentials and allow typechecking to pass. It probably does at this point.

Ericson2314 commented 3 weeks ago

Thanks for remembering, @tathougies.

On a similar note, here and a few other places in beam I would have used data kinds (don't need arbitrary types in our scopes do we?). Do you have thoughts on that?

tathougies commented 3 weeks ago

Yeah, the scoping system could definitely be replaced with data kinds. Keep in mind Haskell looked a lot different when I first wrote beam :)

Ericson2314 commented 1 week ago

@tathougies I believe it, but I also think I don't know just how far back the prehistory of beam goes :).