Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Activity
    Gavin Bisesi
    @Daenyth
    especially for scala it's not uncommon to end up having some db-row-shaped domain model case class and inductively derive implicit wire format and db schema from the case class's field types
    but it's very inflexible and brittle
    the non-brittle option tends to be verbose with near-duplicate classes and a lot of "glue" transformations
    Eric Prud'hommeaux
    @ericprud
    where the case classes act like a switch for print statements?
    Gavin Bisesi
    @Daenyth
    sorry, case class is a scala-ism. It's an immutable record with value equality and some syntactic sugar generated by the compiler. Analogous to python @dataclass
    Eric Prud'hommeaux
    @ericprud
    but it still acts like a switch, doesn't it? you have n case classes with different prototypes and the compiler (or that funny parser who's name i forget) invokes the one that matches the parameters?
    Gavin Bisesi
    @Daenyth
    case class Person(name: String, age: Int)

    There's a relation to pattern matching (scala doesn't "switch" exactly), in that case class gives you a destructuring case binding for free (you could write your own, but compiler does it)

    eg

    val p = Person("fred", 21)
    p match {
      case Person(name, age) => println(s"name $name, age $age")
    }

    prints name fred, age 21

    the "pick a case" comes from case classes often being used to define sum types, and scala having a way to mark the type as closed (non-extendable; sealed is the keyword)

    sealed trait Option[+A] // +A means Option is covariant with A
    case class Some(a: A) extends Option[A]
    case object None extends Option[Nothing]

    and you can

    val opt: Option[Int] = ???
    opt match {
      case Some(x) => println(x)
      case None => println("none")
    }
    and it being sealed means the compiler would tell you if you forgot case None
    Eric Prud'hommeaux
    @ericprud
    yeah, i guess i was thinking of when your matched item is a tuple and the tuples in the cases work with base classes.
    but i should run off and be a parent; my child expects more entertainment when you lock her in a house for days. (yay pandemic)
    Gavin Bisesi
    @Daenyth
    I can relate :)
    Henry Story
    @bblfish
    Re pandemic, there is a close relation between fake news and viruses. In both cases the body has to distinguish the dangerous intruder from the harmless or useful ones, as well as from the bodies own cells. So I have been working on how to use official open linked data to at least help people recognize real institutions. See the 12 use cases I put together over the weekend.
    Gavin Bisesi
    @Daenyth
    I did forget about Chimney, which does actually do a bunch of the transform type things I was talking about, albeit using macros rather than a real language
    https://scalalandio.github.io/chimney/
    Ryan Wisnesky
    @wisnesky
    Hey @Daenyth (Gavin), why don't we try to write down your examples in CQL. I'm also interested in learning about your experience learning about CQL as we do so.
    @joshsh the CGOOD paper reminds me of Braatz; they both use 'categories of graphs' directly and aren't in the 'mainstream' in the sense of not building on monad comprehensions (e.g., LINQ) or 'sketches' (CQL/EASIK/CASL/etc). That it tackles updates is also noteworthy; usually that's a tough follow-up problem
    Ryan Wisnesky
    @wisnesky
    the 'algebraic data integration' paper has 1-2 pages of related work if you're looking for random categorical data models; henry probably knows a bunch too because he's been looking into RDF+CT
    so does categoricaldata.net, for that matter - it contains some foundational non-CQL CT+data papers
    the idea of answering queries by finding 'matchings' or rather, finding homomorphisms from the 'frozen instance' of the query to the input to the query goes back a long way; it's in CGOOD but also e.g. that big property graph report released the other day and most db theory textbooks. in fact one can outright define a conjunctive query language purely semantically this way
    Gavin Bisesi
    @Daenyth
    I don't know CQL just yet, so that would be hard for me to do
    Ryan Wisnesky
    @wisnesky
    Oh yeah, I mean, work through it together. CQL is just a syntax for finitely presented categories and functors and natural transformations
    Henry Story
    @bblfish
    Will go back from reading on law to DL and then back to Scala
    Gavin Bisesi
    @Daenyth

    I think it's becoming clearer to me what things look like.

    Let a Record be an unordered product type where each product element is tagged with a known name.

    Transformations could be declared as first-class objects (a la free applicative models of algebra construction)

    Transformations declare the manner in which they transform something immediately. In contrast to eg: fmap on an Option[A] taking A => B, a Transformation encodes a profunctor-ish shaped (some connection to lenses here I'm certain) transformation either on specific keys, all keys, any keys having some sort of deterministic property, all product fields of a certain type, etc, and declare exactly how the resulting Record is changed - either by removing or adding key-type fields

    Transformations can be polymorphic, for example:

    input: r with { "password": String }
    output: r with { "password": CryptedString }

    the result { "password": CryptedString } splices onto whatever r is given as an input. Because the field "password" is the same name, the new type replaces the old one

    Gavin Bisesi
    @Daenyth
    There's some definite relation to purescript's row types, but polymorphic row types are only type-level constructs. We need a vocabulary of reified transformations to talk about an algebra of transformation composition
    And such transformations could compose in the same manner as normal functions

    Transformations would exist somewhere between value and type level. They would define a value-level algorithm to implement their type-level changes.

    New nominal or structural types could be declared as applying some Transformation to a given type

    so for example: a "sparse PATCH" model for a CRUD http api might define a Patch transformation something like:
    enum Patch a = Update a | Remove | Ignore
    { r | foreach k:t in r -> k: Patch t }
    Gavin Bisesi
    @Daenyth
    hmm so some transformations might apply only at the type level - that one has no value equivalent. We could apply that transform to a type data User = { name: String, age: Int } like:
    type UserPatch = Patch(User)
    // data UserPatch = { name: Patch String, age: Patch Int }
    anyway heading out for the day
    Ryan Wisnesky
    @wisnesky
    have you seen the work on algebraic property graphs? it is based on mediating between graph models that are based on algebraic datatypes. a transformation of a schema is a 'signature morphism', i.e., Functor like thing, combining type and value level operations at once
    Henry Story
    @bblfish
    in his 2003 thesis Access control for the web via proof-carrying authorization L.Bauer uses PCA (proof-carrying authorization) logic, a higher order logic in order for clients to send proofs that they are authorized to access a resource. I guess my main question is: how close can we get to that with RDF?
    Joshua Shinavier
    @joshsh
    @wisnesky thx
    will cite both in the Dagstuhl paper
    Joshua Shinavier
    @joshsh
    @Daenyth I would definitely check out CQL (and APG, too). You can probably get pretty far with the simple mapping language Ryan describes in the paper (https://arxiv.org/abs/1909.04881, section 3.2.3). FYI, Ryan and I are getting ready to do some more work together around transformations specifically. Might be a chance for some interesting discussions in this channel.
    Gavin Bisesi
    @Daenyth
    @wisnesky That sounds really related to what I've been thinking about
    Ryan Wisnesky
    @wisnesky
    the APG stuff? It's implemented in CQL if you want to play with it. Uber's version will get open-sourced eventually too.
    Henry Story
    @bblfish
    I found a very interesting article from 2003 that gives an overview of how Databases fit in the larger information System Design space. IS=DBS+Interaction: Towards Principles of Information System Design. It looks at OO, Agent based systems, coalgebras, Speech acts, Categories as and Abstract state machines, etc... It's an overview, but it is very useful.
    Henry Story
    @bblfish
    Screen Shot 2020-03-21 at 10.31.06.png
    Henry Story
    @bblfish
    actually the article is from 2000 (it was published online 2003). So the authors were really at the bleeding edge.
    Henry Story
    @bblfish
    I have come across some really interesting work that is helping me understand type theory better.
    I was looking around for how speech acts apply to logic and found that Martin-Löf had given a couple of talks on the subject in 2018. Martin-Löf's type theory is what led to Homotopy Type Theory.
    The talk was nowhere to be found on the internet but has been transcribed by Ansten Klev who is one of the coauthors of the book "Immanent Reasoning or Equality in Action".
    That has helped answer a lot of questions I had coming from Philosophical Logic stemming from Frege and Russel. The book really helps point at the differences, but from a Dialogical point of view. CTT seen from a dialogical lens!
    Henry Story
    @bblfish
    Their claim is that "Logic has its roots in Ethics"
    Henry Story
    @bblfish
    Now it would be interesting to find the relation to Cats. I guess it comes from most connectives arising out of adjunctions, relation two categories.
    Henry Story
    @bblfish
    I found Per Martin-Löf's talk "Logic and Ethics" https://twitter.com/bblfish/status/1243936439961870337
    Henry Story
    @bblfish
    This is quite tangential to this group but could be of interest co-immunology and the web. On the other hand who knows. There may be relations to cats that could be usefully explored. I don't know them.