I hereby claim:
- I am balajisivaraman on github.
- I am balajisivaraman (https://keybase.io/balajisivaraman) on keybase.
- I have a public key ASCkCKxKL9ESMggKqg0xNChjorBW4iAXWTk-a_jZzmI91Ao
To claim this, I am signing this object:
trait Animal { | |
fn walk(&self); | |
} | |
struct Dog { | |
name: String | |
} | |
impl Animal for Dog { | |
fn walk(&self) { |
trait Animal { | |
fn walk(&self); | |
} | |
struct Dog { | |
pub name: String | |
} | |
impl Animal for Dog { | |
fn walk(&self) { |
import java.sql.Timestamp | |
import java.time.{Instant, ZonedDateTime} | |
import cats.effect.IO | |
import cats.implicits._ | |
import doobie._ | |
import doobie.implicits._ | |
import fs2.Stream | |
import scodec.bits.ByteVector |
val getJDBCConnection: Reader[JDBCConf, Connection] = ??? | |
val getStatement: Reader[Connection, PreparedStatement] = ??? | |
val executeQuery: Reader[PreparedStatement, ResultSet] = ??? | |
val queryExecutor: Reader[JDBCConf, ResultSet] = getJDBCConnection.andThen(getStatement).andThen(executeQuery) |
I hereby claim:
To claim this, I am signing this object:
Have you read all the documentation at Ensime Emacs? Please do, we put a lot of effort into it. Most problems can be resolved easily by following a simple process, follow through our Troubleshooting guide and share the debugging information below as a gist if you need to escalate. Do not paste this directly into the gitter chat room as it is very verbose.
The goal is to write an API for the tic-tac-toe game. An API user, should be able to play a game of tic-tac-toe using this API, but importantly, it should be impossible for the API user to break the rules of the game. Specifically, if an attempt is made to break a rule, the API should reject the program. This is often done by way of a compile-time type error.
The following API functions should exist:
move: takes a tic-tac-toe board and position and moves to that position (if not occupied) returning a new board. This function can only be called on a board that is empty or in-play. Calling move on a game board that is finished is a compile-time type error.
whoWon: takes a tic-tac-toe board and returns the player that won the game (or none if neither has won). This function can only be called on a board that is finished. Calling whoWon on a game board that is empty or in-play is a compile-time type error.
playerAt: takes a tic-tac-toe board and position and returns the (possible) player at a given posi
sealed trait List[+T] | |
case object Nil extends List[Nothing] | |
case class Cons[+T](head: T, tail: List[T]) extends List[T] | |
object List { | |
def head[T](list: List[T]): T = list match { | |
case Nil => throw new RuntimeException("Empty List") | |
case Cons(x, _) => x | |
} |
-- >>> skips "ABCD" | |
-- ["ABCD","BD","C","D"] -- This passes. | |
-- >>> skips "ABCD" | |
-- ["ABCD", "BD", "C", "D"] -- This doesn't pass. I assume because of the whitespace. Why? | |
-- But both are equal according to GHCi. | |
skips :: [a] -> [[a]] | |
skips l = map (getItems l) [1..length l] | |
where | |
getItems :: [a] -> Int -> [a] | |
getItems l n = map (l !!) [n-1,2*n-1..length l - 1] |