statebox / cql

CQL: Categorical Query Language implementation in Haskell
GNU Affero General Public License v3.0
162 stars 14 forks source link

refactor, program options, timeout #109

Closed wisnesky closed 5 years ago

wisnesky commented 5 years ago

I added a timeout' function but it just straight up doesn't work. It just wraps a library call so it should be obvious. There's probably an issue with laziness or the IO monad.

wisnesky commented 5 years ago

By putting in the underscores the name of the constructor directly matches the name of the option, so there's no need to mediate between strings found in aql files and these options. You can see some machinery for this laying around.

On Oct 28, 2018, at 10:59 AM, Erik Post notifications@github.com wrote:

@epost commented on this pull request.

In src/Language/Options.hs:

data BoolOption =

  • Require_Consistency
  • | Schema_Only --- | Allow_Java_Eqs_Unsafe
  • | Dont_Validate_Unsafe
  • | Always_Reload
  • | Program_Allow_Nonconfluence_Unsafe --- | Query_Compose_Use_Incomplete
  • | Query_Remove_Redundancy
  • | Import_As_Theory
  • | Import_Joined
  • | Prepend_Entity_On_Ids +-- Require_Consistency Hmm, could we drop the underscores? I guess in certain exceptional cases it may be wortwhile having them, but all of these things seem like they may as well not be there.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or mute the thread.

wisnesky commented 5 years ago

The options were designed to be keys in maps rather than containers of values. This makes certain aspects of parsing and dealing with them easier.

On Oct 28, 2018, at 11:13 AM, Erik Post notifications@github.com wrote:

@epost requested changes on this pull request.

Thanks Ryan! This needs some formatting improvements of the same type as previous PRs, eg #98. You could either do it by some (possibly in-editor) tool, by hand, or wait for someone else to do it, or wait until we've figured out how to get editorconfig, hlint, hindent, etc to do it the way we want it, eg with newlines after do and where, and all the other things mentioned in the code standards linked from the AQL Developer Documentation.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or mute the thread.

wisnesky commented 5 years ago

If other people or automated processes can do things like format the code, but I'm the only one who can add new features, surely I should spend all my time adding new features?

On Oct 28, 2018, at 11:13 AM, Erik Post notifications@github.com wrote:

@epost requested changes on this pull request.

Thanks Ryan! This needs some formatting improvements of the same type as previous PRs, eg #98. You could either do it by some (possibly in-editor) tool, by hand, or wait for someone else to do it, or wait until we've figured out how to get editorconfig, hlint, hindent, etc to do it the way we want it, eg with newlines after do and where, and all the other things mentioned in the code standards linked from the AQL Developer Documentation.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or mute the thread.

wisnesky commented 5 years ago

In fact, there are many places where AQL deliberately prefers 'products of maps' to 'maps of co-products'. This makes AQL verbose (e.g., Term has 5 constructors, Programs have 7 maps, etc). I tried the opposite in AQL's predecessor, OPL (where Term has 2 constructors, Var and Const, etc). In many cases in AQL, when you have an isomorphism

A + B -> C ~ (A -> C) * (B -> C)

it is the case that in the (f, g) :: (A -> C) * (B -> C) on the RHS that g depends on f but f doesn't depend on g (i.e., attributes, terms, and type-related things are "built over" the foreign keys, paths, and entity related things, but no foreign keys from types to entities, for example.). The 'maximally factored' RHS is verbose, but I prefer it to OPL. That being said, there's probably clever ways to capture such dependency using the type A + B -> C directly.

epost commented 5 years ago

Thanks Ryan! 👍