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
package deiko | |
import scala.concurrent.Future | |
import scala.concurrent.duration.Duration | |
import scalaz.concurrent.Task | |
import scalaz.stream._ | |
import play.api.libs.iteratee._ | |
import Process._ | |
object Conversion { |
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 RankNTypes #-} | |
type Foo = forall m. Monad m => Int -> m Int | |
data Free f a = Pure a | |
| Free (f (Free f a)) | |
data Instr a = Instr Int a | |
instance Functor Instr 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
ghc -Wall -ferror-spans -fforce-recomp -c /home/yorick/Desktop/process.hs | |
/home/yorick/Desktop/process.hs:34:9-34: | |
Couldn't match type `a1' with `a2' | |
because type variable `a2' would escape its scope | |
This (rigid, skolem) type variable is bound by | |
a type expected by the context: | |
m a2 -> (a2 -> Process m a) -> Process m a -> r | |
The following variables have types that mention a1 | |
awaiting :: m a1 -> (a1 -> Process m a) -> Process m a -> r |
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 | |
trait Functor[F[_]] { | |
def map[A, B](fa: F[A])(f: A => B): F[B] | |
} | |
object Functor { | |
def apply[F[_], A, B](fa: F[A])(f: A => B)(implicit F: Functor[F]): F[B] = | |
F.map(fa)(f) | |
} |
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
sealed trait Free[F[_], A] | |
case class Return[F[_], A](v: A) extends Free[F, A] | |
case class Suspend[F[_], A](s: F[Free[F, A]]) extends Free[F, A] | |
sealed trait ProcessB[T[_], O, B] | |
case class Emit[T[_], O, B](o: O, next: B) extends ProcessB[T, O, B] | |
case class Await[T[_], A, O, B](ta: T[A], k: A => B) extends ProcessB[T, O, B] | |
case class Stop[T[_], O, B] extends ProcessB[T, O, B] | |
type Process[T[_], O] = Free[({ type F[x] = ProcessB[T,O,x] })#F, O] |
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 NoImplicitPrelude #-} | |
module Origami where | |
import Prelude | |
( | |
(.) | |
, (-) | |
, (*) | |
, (++) | |
, ($) |
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
From d8730a5b72f263754e82c5e18ee53abf0c002b46 Mon Sep 17 00:00:00 2001 | |
From: YoEight <[email protected]> | |
Date: Sat, 11 Jan 2014 13:30:23 +0100 | |
Subject: [PATCH] Apply changes relative to TH.Pred becoming a TH.Type's | |
synonym (issue #7021) | |
--- | |
compiler/deSugar/DsMeta.hs | 53 +++++++++++++++++++---------------------- | |
compiler/hsSyn/Convert.lhs | 16 +++++-------- | |
compiler/typecheck/TcSplice.lhs | 41 +++++++++++++++++++++++-------- |
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
Sun Feb 2 20:44 2014 Time and Allocation Profiling Report (Final) | |
spellcheck +RTS -p -sstderr -RTS | |
total time = 0.00 secs (0 ticks @ 1000 us, 1 processor) | |
total alloc = 90,424 bytes (excludes profiling overheads) | |
COST CENTRE MODULE %time %alloc | |
CAF GHC.IO.Handle.FD 0.0 38.4 |
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 ExistentialQuantification #-} | |
{-# LANGUAGE RankNTypes #-} | |
{-# LANGUAGE GADTs #-} | |
module Data.Process where | |
import Prelude hiding (zipWith) | |
import Control.Applicative | |
import Control.Monad | |
import Data.Foldable |
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 Data.Functor.Foldable | |
divIfMultiple :: Integral a => a -> [a] -> Maybe [a] | |
divIfMultiple x = cata go | |
where | |
go Nil = Just [] | |
go (Cons a r) | |
| mod a x == 0 = fmap (div a x:) r | |
| otherwise = Nothing |