Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Minor updates #48

Merged
merged 5 commits into from
Sep 11, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@ Installation
------------
With Scala CLI: add the following to your `project.scala` file.
```scala
//> using dep "ch.epfl.tyqu::tyqu:0.0.1"
//> using dep "ch.epfl.tyqu::tyqu:0.1.0"
```

With sbt: add the following to your `build.sbt` file.
```scala
libraryDependencies += "ch.epfl.tyqu" %% "tyqu" % "0.0.1"
libraryDependencies += "ch.epfl.tyqu" %% "tyqu" % "0.1.0"
```

Usage
Expand Down
67 changes: 0 additions & 67 deletions src/demo/Demo.scala

This file was deleted.

10 changes: 4 additions & 6 deletions src/main/Expression.scala
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,15 @@ import scala.annotation.targetName

import utils.IsTupleOf
import Tuple.Fold
import scala.compiletime.ops.boolean.*


type Numeric = Int | Long | Float | Double
type Primitive = Numeric | String | Char | Boolean

type LogicalAnd[A, B] <: Boolean = (A, B) match
case (true, true) => true
case _ => false

type ForAll[T <: Tuple, Pred[X] <: Boolean] <: Boolean = T match
case EmptyTuple => true
case h *: t => LogicalAnd[Pred[h], ForAll[t, Pred]]
case h *: t => Pred[h] && ForAll[t, Pred]

type CanSelectExpr[T] <: Boolean = T match
case Expression[?, true] => true
Expand Down Expand Up @@ -176,10 +173,11 @@ extension (lhs: Expression[?, ?])
infix def +[T, S <: Boolean](rhs: Expression[T, S]) = lhs.concat(rhs)


extension (lhs: Expression[String, ?])
extension [S <: Boolean] (lhs: Expression[String, S])
def startsWith(rhs: String) = StartsWith(needle = rhs, haystack = lhs)
def endsWith(rhs: String) = EndsWith(needle = rhs, haystack = lhs)
def contains(rhs: String) = Contains(needle = rhs, haystack = lhs)
def length = Function[Int]("LENGTH", lhs)


extension [T <: Numeric | Null, E <: Expression[T, true]] (qb: QueryBuilder[E])
Expand Down
1 change: 0 additions & 1 deletion src/main/ScopeFactory.scala
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package tyqu

import scala.quoted.*
import scala.annotation.tailrec
import org.checkerframework.checker.units.qual.m


trait RefinedScope[S <: Scope]:
Expand Down