!SLIDE
!SLIDE
package scalaz | |
import scalaz.{State => _, _} | |
import scalaz.Free.FreeC | |
import scalaz.Id.Id | |
import FreeState.StateF | |
sealed abstract class FreeState[S, A] { | |
def map[B](f: A => B): FreeState[S, B] | |
} |
{-# LANGUAGE RankNTypes #-} | |
data Free f a = | |
Done a | |
| More (f (Free f a)) | |
instance Functor f => Functor (Free f) where | |
fmap f (Done a) = | |
Done (f a) | |
fmap f (More k) = |
import scalaz._ | |
import \/._ | |
import Free._ | |
import scalaz.syntax.monad._ | |
import java.util.concurrent.atomic.AtomicReference | |
import java.util.concurrent.CountDownLatch | |
object Experiment { | |
sealed trait OI[A] { | |
def map[B](f: A => B): OI[B] |
object Trampolines { | |
def odd[A](as: List[A]): TailRec[Boolean] = | |
as match { | |
case Nil => Return(false) | |
case _ :: xs => Suspend(() => even(xs)) | |
} | |
def even[A](as: List[A]) = as match { | |
case Nil => Return(true) | |
case _ :: xs => Suspend(() => odd(xs)) |
module type Functor = sig | |
type 'a t | |
val map : ('a -> 'b) -> 'a t -> 'b t | |
end | |
module type Monad = sig | |
type 'a t | |
val map : ('a -> 'b) -> 'a t -> 'b t | |
val return : 'a -> 'a t |
!SLIDE
!SLIDE
You might suspect something to be true (a conclusion). You question why you believe it to be true -- hypothesis formation. When you fail to find reasons to believe it to be true, you abandon the hypothesis. It could be that:
package com.nicta | |
package jdbc | |
import java.sql.SQLException | |
import scalaz._, Scalaz._ | |
// 1 + A | |
sealed trait ?[A] { | |
import ?._ |
module Lens where | |
open import Level | |
open import Function | |
open import Relation.Binary | |
open import Data.Product | |
open import Relation.Binary.Product.Pointwise | |
open import Data.Sum | |
open import Relation.Binary.Sum | |
open import Data.Empty | |
open import Function.Inverse |