Skip to content

Instantly share code, notes, and snippets.

@ailiev
ailiev / exampleWriterTraverse.scala
Created August 22, 2012 23:23
Scalaz Writer and traverse / mapM example
import scalaz._
import Scalaz._
object ScalazPlay extends App
{
// having this one-param type is critical for the subsequent type inference!
type MyWriter[A] = Writer[List[String],A]
def f1(i:Int) : MyWriter[Int] = for {
@ailiev
ailiev / exampleWriterTraverse.scala
Created August 22, 2012 23:22
Scalaz Writer and traverse / mapM example
import scalaz._
import Scalaz._
object ScalazPlay extends App
{
// having this one-param type is critical for the subsequent type inference!
type MyWriter[A] = Writer[List[String],A]
def f1(i:Int) : MyWriter[Int] = for {
@ailiev
ailiev / sybclass2.scala
Created August 18, 2012 19:15
Modified shapeless SYB example
/*
* Copyright (c) 2012 Miles Sabin
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
@ailiev
ailiev / gist:1346573
Created November 7, 2011 23:44
Haskell digit printing
> import List (transpose, intersperse)
> import Char (isSpace)
> ref::[String]
> ref = [
> " -- -- -- -- -- -- -- -- ",
> "| | | | | | | | | | | | | |",
> "| | | -- -- -- -- |-- | |--| -- ",
> "| | | | | | | | | | | | |",