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
module Main where | |
import Control.Monad | |
data P i o a | |
= Input (i -> P i o a) | |
| Output o (P i o a) | |
| Return a | |
instance Functor (P i o) where |
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 DeriveFunctor #-} | |
{-# LANGUAGE ApplicativeDo #-} | |
{-# LANGUAGE GADTs #-} | |
{-# LANGUAGE RankNTypes #-} | |
{-# LANGUAGE Arrows #-} | |
{-# LANGUAGE ConstraintKinds #-} | |
module Task where | |
import Prelude hiding (id, (.)) |
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
trait Eq[A] { | |
val eq: String | |
} | |
trait Ord[A] { | |
val ord: String | |
} | |
implicit val eqInt: Eq[Int] | |
= new Eq[Int] { val eq = "eqInt"} | |
implicit val ordInt: Ord[Int] |
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
module Main where | |
import Prelude | |
import Data.Set as S | |
import Data.Array | |
import Data.Lazy | |
import Data.Maybe | |
import Data.Tuple |
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
module Main where | |
import Prelude | |
import Data.Foreign.EasyFFI | |
import Control.Monad.Eff (Eff) | |
import Control.Monad.Eff.Console (CONSOLE, log) | |
-- code for wrapping impure functions |
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
//------------------------- | |
// Monad Transformer | |
//------------------------- | |
import cats.data._ | |
import cats.implicits._ | |
import cats._ | |
type MonadStackStateTEither[ErrorType, StateType, ReturnType] = | |
StateT[Either[ErrorType, ?], StateType, ReturnType] |
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
class BlockOp(implicit ec: ExecutionContext) { | |
def blockOp(number: Int) = Future { | |
Thread.sleep(2000) | |
println(s"$number after sleep, time is now ${System.currentTimeMillis() / 1000}") | |
number | |
} | |
} | |
sealed trait TestTraverse[A] | |
case class BlockingOp(number: Int) extends TestTraverse[Int] |