agentm / project-m36

Project: M36 Relational Algebra Engine
The Unlicense
876 stars 47 forks source link

Atom, AtomType, AtomFunction #240

Closed YuMingLiao closed 5 years ago

YuMingLiao commented 5 years ago

hi, @agentm I would like to ask a naive question: Why do project-m36 need Atom, AtomType, AtomFunction apart from haskell plain type and function? It seems if all Atomable a is an atom itself without toAtom, then we don't need to make ConstructedAtom, AtomType and AtomFunction.

YuMingLiao commented 5 years ago

Okay, I see why. I can't find a way to dynamically apply any haskell-space function to a HList of argument. So the declaration of an AtomFunction is necessary.

YuMingLiao commented 5 years ago

I also got a reason from #197

avoiding the local requirement of a GHC package database installation- which is understandable- while being able to link in a new function

agentm commented 5 years ago

Atomable is a client-side, Haskell-space convenience typeclass to marshal Haskell ADTs to Atoms, which are the values stored in the database. The server knows nothing about Atomable.

AtomType represents all the possible value types and is used almost exclusively for typechecking and introspection.

AtomFunction is a server-side function which can either built into the database or implemented as a script in Haskell and triggered by DatabaseContextExprs.

ConstructedAtom allows dynamic, run-time creation of ADT-based values. Before ConstructedAtom the database values could only be primitives.