This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
April Talk 1: Austin Seipp | |
April Talk 2: ? (maybe lightning talks, or book someone else) | |
May Talk 1: Fere (François-René ÐVB Rideau) | |
May Talk 2: ? (maybe lightning talks, or book someone else) | |
June Talk 1: Maybe Nathan Howell (but possibly some other month, Ed needs to follow up) | |
June Talk 2 ? | |
Later: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{-# LANGUAGE GADTs, ConstraintKinds, Rank2Types, ImplicitParams #-} | |
data Rec fields where | |
Rec :: fields => Rec fields | |
infixr 1 ? | |
(?) :: Rec fields -> (fields => r) -> r | |
Rec ? e = e | |
record :: Rec (?a :: Int, ?b :: String) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
*ghci> g | |
Game {, [Josh rack: HXDOTQI score: 0id: 0] :| [[Nick rack: KGAITTE score: 0id: 1]], ______________________________________________ | |
|3W| | |2L| | | |3W| | | |2L| | |3W| | |
| |2W| | | |3L| | | |3L| | | |2W| | | |
| | |2W| | | |2L| |2L| | | |2W| | | | |
|2L| | |2W| | | |2L| | | |2W| | |2L| | |
| | | | |2W| | | | | |2W| | | | | | |
| |3L| | | |3L| | | |3L| | | |3L| | | |
| | |2L| | | |2L| |2L| | | |2L| | | | |
|3W| | |2L| | | | *| | | |2L| | |3W| |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ stack ghci | |
*ghci> import Data.Aeson | |
*ghci> let g = unsafeNewGame [human "josh"] | |
*ghci> let g = unsafeNewGame [human "josh", human "nick"] | |
*ghci> g | |
Game {, [[josh rack: DOERUTO score: 0id: 0],[nick rack: ELIALIH score: 0id: 1]], ______________________________________________ | |
|3W| | |2L| | | |3W| | | |2L| | |3W| | |
| |2W| | | |3L| | | |3L| | | |2W| | | |
| | |2W| | | |2L| |2L| | | |2W| | | | |
|2L| | |2W| | | |2L| | | |2W| | |2L| |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import scala.language.higherKinds | |
import scalaz.{Applicative, Traverse} | |
import scalaz.\/ | |
import scalaz.std.list._ | |
import scalaz.std.option._ | |
import scalaz.syntax.either._ | |
import scalaz.syntax.traverse._ | |
object Mappy { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//libraryDependencies += "org.scalaz" %% "scalaz-core" % "7.2.0" | |
import scala.language.higherKinds | |
import scalaz.{MonadState, MonadListen, MonadReader, MonadError, \/} | |
import scalaz.std.list._ | |
// All I want to do in this code is invoke the eval function. That's it. | |
// This code compiles, so it's close, just needs the finishing touch. | |
object HowDoICallEval { |
Let's say I want to look something up in an environment (like Map String Int
or something, doesn't really matter). I start with Reader for the Env,
and I use the ask
function.
type Env = Map String Int
envLookup :: String -> Reader Env Int
envLookup key = (Maybe.fromMaybe (error "unbound var") . Map.lookup key) <$> ask
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
type R[A] = Reader[Env, A] | |
type Z[F[_], A] = WriterT[F, Output, A] | |
type W[A] = Z[R, A] | |
def evalLocal(x: String, i: Int, exp: Exp): W[Int] = { | |
WriterT[R,Output,Int]( | |
Reader[Env, (Output, Int)] { (env: Env) => | |
eval(exp).run.run(env + (x -> i)) | |
} | |
) |