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 Thing[+A] | |
object Thing { | |
case class SomeThing[A](value: A, next: Thing[A]) extends Thing[A] | |
case object NotAThing extends Thing[Nothing] | |
} |
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. |
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 |
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 |
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 |
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 = |
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 |
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,???]] = ... |
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._ |
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."); |
NewerOlder