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 scalaz._, Scalaz._ | |
import shapeless._ | |
case class Codec[A](to: A => List[String], from: List[String] => String \/ (List[String], A)) { | |
def bimap[B](f: A => B, g: B => A): Codec[B] = | |
Codec[B](g andThen to, x => from(x).map(_.map(f))) | |
} | |
import scala.util.Try | |
import scala.util.{Success => TrySuccess} |
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
/** | |
* Generated by Scrooge | |
* version: 3.12.0 | |
* rev: acdb2135b6b8ab36c09a93fb3d502295ba9a27b6 | |
* built at: 20140110-113906 | |
*/ | |
package com.example | |
import com.twitter.scrooge.{ | |
TFieldBlob, ThriftException, ThriftStruct, ThriftStructCodec3, ThriftUtil} |
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
def dsortNat[A](z: NatOrd, xs: Stream[(Int,A)]): Stream[Stream[A]] = { | |
val arr = new Array[MutableList[A]](z.i+1) | |
xs.foreach { arg: (Int,A) => | |
val idx = arg._1 | |
if(arr(idx) == null) arr(idx) = MutableList[A](arg._2) | |
else arr(idx) += arg._2 | |
} | |
arr.toStream.filter(_ != null).map(_.toStream) | |
} |
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
lens - more than a curiosity | |
Lenses are a simple but very useful construct that provide views | |
over data for retrieval and modification in a compositional way. | |
The `lens` library in haskell (a.k.a. Control.Lens) takes this idea | |
to an extreme. This talk will provide a bit of a history around | |
lens encodings, and then attempt to demonstrate that `lens` should be | |
an essential part of any haskellers toolkit, and not just a curiosity, | |
or nice toy. |
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
def x[M[_]: MonadPlus, A, B](xs: List[A], f: A => M[B]): M[B] = | |
xs.foldLeft(implicitly[MonadPlus[M]].empty[B])((acc, a) => implicitly[MonadPlus[M]].plus(acc, f(a))) |
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
the contents of a |
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
Title: Introduction to Functional Programming (3-day workshop) | |
Presenters: Mark Hibberd, Katie Miller and Tony Morris | |
When: Monday 17, Tuesday 18 & Wednesday 19 March, 2014 | |
Time: 9:00am- 5:00pm (lunch will be provided) | |
Where: Red Hat, Level 1, 193 North Quay, Brisbane QLD 4000 | |
Cost: Free | |
Abstract: In conjunction with the Lambda Ladies group, NICTA will be hosting a free hands-on, three day Introduction to Functional Programming, for interested participants (internal and external). This event is targeted toward women who are interested in learning about functional programming and preference will be applied accordingly. | |
We will be using the Haskell programming language for our journey over the three days and this session requires no prior experience with functional programming. |
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
Title: Introduction to Functional Programming (3-day workshop) | |
Presenters: Mark Hibberd, Katie Miller and Tony Morris | |
When: Monday 17, Tuesday 18 & Wednesday 19 March, 2014 | |
Time: 9:00am- 5:00pm ( lunch will be provided) | |
Where: Red Hat, Level 1, 193 North Quay, Brisbane QLD 4000 | |
Cost: Free | |
Abstract: In conjunction with the Lambda Ladies group, NICTA will be hosting a free hands-on, three day Introduction to Functional Programming, for interested participants (internal and external). This event is targeted toward women who are interested in learning about functional programming and preference will be applied accordingly. | |
We will be using the Haskell programming language for our journey over the three days and this session requires no prior experience with functional programming. |
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
scala> import TypeCheckedTripleEquals._ | |
warning: there were 1 deprecation warning(s); re-run with -deprecation for details | |
import TypeCheckedTripleEquals._ | |
scala> def x[A](x: A, y: A): Boolean = x === y | |
warning: there were 1 deprecation warning(s); re-run with -deprecation for details | |
x: [A](x: A, y: A)Boolean | |
scala> x(1, ()) | |
warning: there were 1 deprecation warning(s); re-run with -deprecation for details |
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
scala> class X | |
defined class X | |
scala> class Y extends X | |
defined class Y | |
scala> def some[A](f: A)(implicit ev: A => X): X = ev(f) | |
some: [A](f: A)(implicit ev: A => X)X | |
scala> some(new X) |