Skip to content
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
14 changes: 1 addition & 13 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,11 @@ jobs:
strategy:
matrix:
os: [ubuntu-latest]
scala: [3.1.0, 2.12.15, 2.13.7]
scala: [3.1.0, 2.13.7]
java: [corretto@8, corretto@11]
exclude:
- scala: 3.1.0
java: corretto@11
- scala: 2.12.15
java: corretto@11
runs-on: ${{ matrix.os }}
steps:
- name: Checkout current branch (full)
Expand Down Expand Up @@ -120,16 +118,6 @@ jobs:
tar xf targets.tar
rm targets.tar

- name: Download target directories (2.12.15)
uses: actions/download-artifact@v2
with:
name: target-${{ matrix.os }}-2.12.15-${{ matrix.java }}

- name: Inflate target directories (2.12.15)
run: |
tar xf targets.tar
rm targets.tar

- name: Download target directories (2.13.7)
uses: actions/download-artifact@v2
with:
Expand Down
8 changes: 8 additions & 0 deletions .scalafmt.conf
Original file line number Diff line number Diff line change
@@ -1,6 +1,14 @@
version = 3.2.1

runner.dialect = Scala213Source3
fileOverride {
"glob:**/scala-3/**/*.scala" {
runner.dialect = scala3
}
"glob:**/scala-2.13/**/*.scala" {
runner.dialect = scala213
}
}

maxColumn = 96

Expand Down
2 changes: 1 addition & 1 deletion build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ ThisBuild / baseVersion := "0.1"
ThisBuild / organization := "org.typelevel"
ThisBuild / organizationName := "Typelevel"

ThisBuild / crossScalaVersions := Seq("3.1.0", "2.12.15", "2.13.7")
ThisBuild / crossScalaVersions := Seq("3.1.0", "2.13.7")

ThisBuild / developers := List(
Developer("armanbilge", "Arman Bilge", "@armanbilge", url("https://github.com/armanbilge")),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ object CloudFormationCustomResource {
client: Client[F],
handler: CloudFormationCustomResource[F, Input, Output])(
implicit
env: LambdaEnv[F, CloudFormationCustomResourceRequest[Input]]): F[Option[Unit]] = {
env: LambdaEnv[F, CloudFormationCustomResourceRequest[Input]]): F[Option[INothing]] = {
val http4sClientDsl = new Http4sClientDsl[F] {}
import http4sClientDsl._

Expand Down
38 changes: 38 additions & 0 deletions lambda/shared/src/main/scala-2/feral/lambda/package.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
/*
* Copyright 2021 Typelevel
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package feral

import io.circe.Encoder

import scala.annotation.nowarn

package object lambda {
/**
* Alias for `Nothing` which works better with type inference. Inspired by fs2, but inlined
* here to avoid pulling in an otherwise-unnecessary dependency.
*/
type INothing <: Nothing

/**
* This can't actually be used. It's here because `IOLambda` demands an Encoder for its result
* type, which should be `Nothing` when no output is desired. Userland code will return an
* `Option[Nothing]` which is only inhabited by `None`, and the encoder is only used when the
* userland code returns `Some`.
*/
@nowarn("msg=dead code following this construct")
implicit val nothingEncoder: Encoder[INothing] = (_: INothing) => ???
}
38 changes: 38 additions & 0 deletions lambda/shared/src/main/scala-3/feral/lambda/INothing.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
/*
* Copyright 2021 Typelevel
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package feral.lambda

import io.circe.Encoder

import scala.annotation.nowarn

/**
* Alias for `Nothing` which works better with type inference. Inspired by fs2, but inlined here
* to avoid pulling in an otherwise-unnecessary dependency.
*/
type INothing <: Nothing
object INothing {

/**
* This can't actually be used. It's here because `IOLambda` demands an Encoder for its result
* type, which should be `Nothing` when no output is desired. Userland code will return an
* `Option[Nothing]` which is only inhabited by `None`, and the encoder is only used when the
* userland code returns `Some`.
*/
@nowarn("msg=dead code following this construct")
implicit val nothingEncoder: Encoder[INothing] = (_: INothing) => ???

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not 100% sure but can't this just return its argument? (a: INothing) => a. INothing <: Nothing and Nothing <: Json.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good idea, this does work :)

}