View Expressions.v
This file contains 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
Require Import String. | |
Inductive ty : Type := | |
| TInt : ty | |
| TString : ty. | |
Inductive Value : Type := | |
| VInt : nat -> Value | |
| VString : string -> Value. |
View Traverse.hs
This file contains 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
module Traverse where | |
import Prelude hiding (Monad, Functor, Either, Left, Right, map, traverse, pure) | |
-- So, you probably already have a natural intuition for | |
-- the fact that types are similar to the idea of sets | |
-- from mathematics. | |
-- So, lets imagine all of the sets (types) we can describe | |
-- in Haskell. We understand how to work with the inhabitants |
View Combining.hs
This file contains 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
module Combining where | |
import Prelude hiding (Semigroup) | |
import Data.List as List | |
-- We know that lots of things can be combined together. | |
combineLists :: [a] -> [a] -> [a] | |
combineLists [] [] = [] | |
combineLists [] ys = ys |
View Pangram.hs
This file contains 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
module Pangram where | |
import Data.Set (Set) | |
import Data.Set as Set | |
import Data.Char (toLower, isLetter) | |
import Data.List as List | |
isPangram :: [Char] -> Bool |
View Age.hs
This file contains 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 GeneralizedNewtypeDeriving #-} | |
module Age where | |
main :: IO () | |
main = do | |
print "Hello, world." | |
print $ show $ ageOn Mecury (earthYearInSeconds * 38) | |
data Planet = |
View sqlast.scala
This file contains 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
sealed trait AST | |
case class Query(selectClause: List[ColumnExp], ...) extends AST | |
sealed trait Exp extends AST | |
sealed trait QIdent extends Exp | |
case class QIdentBase(name: String) extends QIdent | |
case class QIdentDot(qualifier: QIdent, name: QIdentBase) extends QIdent |
View CustomError.scala
This file contains 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
sealed trait DaxcoError | |
case object NotFound extends DaxcoError | |
case object NoClasses extends DaxcoError | |
case object ClassFull extends DaxcoError | |
def someApiCall(someInput: ???): IO[Either[DaxcoError,???]] = ... |
View main.scala
This file contains 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 java.util.concurrent.Executors | |
import cats.effect._ | |
import cats.implicits._ | |
import org.http4s.{HttpApp, HttpRoutes} | |
import org.http4s.syntax._ | |
import org.http4s.dsl.io._ | |
import org.http4s.implicits._ | |
import org.http4s.server.Router | |
import org.http4s.server.blaze._ |
View random.java
This file contains 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
package com.kyrlach.coinflip; | |
import java.util.Random; | |
import java.util.Scanner; | |
public class Program { | |
public static void main(String[] args) { | |
Scanner s = new Scanner(System.in); | |
Random r = new Random(); | |
System.out.println("Hello."); |
View Board.java
This file contains 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
public String toString() { | |
StringBuilder sb = new StringBuilder(); | |
for(int i = 1; i <= 9; i++) { | |
Piece piece; | |
try { | |
piece = pieceAt(i); | |
} catch (Exception ex) { | |
throw new RuntimeException(ex); | |
} | |
switch(piece) { |
NewerOlder