I hereby claim:
- I am kalexmills on github.
- I am kalexmills2021 (https://keybase.io/kalexmills2021) on keybase.
- I have a public key ASDAjVsDVzqIvRcW6yjynPsMwtNjqwucMs3rA736RD1JVQo
To claim this, I am signing this object:
package main | |
// Path represents a looping sequence of points which are interpolated between. | |
// FIXME: this doesn't loop properly at the moment. It will need to be recreated whenever the animation completes. | |
type Path struct { | |
sequence *gween.Sequence | |
points []image.Point | |
idx int | |
} |
I hereby claim:
To claim this, I am signing this object:
-- sqlite3 flavored SQL | |
CREATE TABLE comment ( | |
id INTEGER PRIMARY KEY ASC, | |
parent_id INTEGER, | |
content TEXT NOT NULL, | |
create_time TEXT NOT NULL, | |
is_deleted INTEGER DEFAULT 0, | |
FOREIGN KEY(parent_id) references comment(id) |
package main | |
import ( | |
"fmt" | |
"io" | |
"log" | |
"strings" | |
) | |
func main() { |
import cats._ | |
import cats.data._ | |
import cats.implicits._ | |
import cats.syntax._ | |
import cats.effect._ | |
import cats.effect.concurrent._ | |
import cats.effect.implicits._ | |
import cats.effect.ExitCase._ | |
import cats.arrow.Compose |
/** | |
* Asynchronous CBOR message traffic via tokio / serde. More at https://cbor.io | |
* | |
* Test via `cargo run` and, in a separate terminal test using these messages. | |
* | |
* $ echo '00000017A2616364526561646161826568656C6C6F65776F726C64' | xxd -r -p | nc 127.0.0.1 6142 | |
* $ echo '0000000FA1616D6B68656C6C6F20776F726C64' | xxd -r -p | nc 127.0.0.1 6142 | |
* | |
* First 8 bytes are the length of the data frame, rest is the CBOR message. | |
*/ |
package com.niftysoft.gennit.util | |
import cats._ | |
import cats.implicits._ | |
import scala.annotation.tailrec | |
case class MultiSet[V] private (data: Map[V,Int]) { | |
def filter(f: V => Boolean): MultiSet[V] = MultiSet(data.filter{case(v, mul) => f(v)}) |
import cats.data.Reader | |
import scala.reflect.ClassTag | |
/** | |
* Distribution takes a PFloat and returns an A. | |
*/ | |
type Distribution[A] = Reader[PFloat, A] | |
/** | |
* PFloat represents a Float describing a probability. Its value is always between |
Contracts are a creative solution to generics, but they are also unexpected, weird, and possibly unnecessary.
Emily Maier's suggestion that contracts are superfluous is a good one. Interfaces in Go already serve as a kind of contract.
She has observed that, under the current proposal, it would be valid to copy-and-paste the function body into the contract. While the code would compile and presumably run. Go has already made design choices which limit the realm of the possible to keep developers from shooting themselves in the foot.
Contracts in Go only seem to be needed since code needs to assert at compile time that generic types can be used in built-in operations (i.e. that they satisfy a certain operational interface). Rather than introducing a new language construct, it seems more coherent to make these operational interfaces available