Skip to content

Instantly share code, notes, and snippets.

@djspiewak
Created October 15, 2019 23:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save djspiewak/34f77747ccd91551048e0d59111f3b97 to your computer and use it in GitHub Desktop.
Save djspiewak/34f77747ccd91551048e0d59111f3b97 to your computer and use it in GitHub Desktop.
/*
* Copyright 2014–2019 SlamData Inc.
*
* 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 quasar.api.destination
import argonaut.CodecJson
import argonaut.Argonaut.{UnitDecodeJson, UnitEncodeJson}
import cats.{Eq, Show}
import cats.data.NonEmptyList
import quasar.api.table.ColumnType
import scodec.Codec
import scala.{sys, List, Nil, Nothing, Unit}
import scala.util.Right
trait UntypedDestination[F[_]] extends Destination[F] {
type Type = Unit
type Constructor = Nothing
implicit val showType: Show[Unit] = Show[Unit]
implicit val eqType: Eq[Unit] = Eq[Unit]
implicit val codecType: Codec[Unit] = Codec[Unit]
implicit val jsonCodecType: CodecJson[Unit] =
CodecJson[Unit](UnitEncodeJson.encode, UnitDecodeJson.decode)
implicit val eqConstructor: Eq[Nothing] =
Eq.by[Nothing, Nothing](_ => sys.error("impossible"))
implicit val jsonCodecConstructor: CodecJson[Nothing] =
CodecJson[Nothing](_ => sys.error("impossible"), _ => sys.error("impossible"))
val types = List(())
val constructors = Nil
def coerce(tpe: ColumnType) =
TypeCoercion.Satisfied(NonEmptyList.one(Right(())))
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment