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
combinations:: String -> [String] | |
combinations [] = [] | |
combinations (x:xs) = [x] : combs ++ fmap (x :) combs | |
where combs = combinations xs |
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 fun(k:Int)={ | |
val x = f(k) | |
val y = g(x) | |
val z = h(y) | |
x+y+z | |
} | |
// If f,g,h return Option | |
def fun1(k:Int)=for { |
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 GADTs #-} | |
module HLists where | |
data Hlist where | |
HNil :: Hlist | |
HCons :: a-> Hlist -> Hlist | |
HConsShw :: Show a => a-> Hlist -> Hlist -- show here is horrible | |
instance Show Hlist | |
where show HNil = "" | |
show (HCons a l) = "?" ++ ","++ show l |
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
-- | Main entry point to the application. | |
module Main where | |
-- | The main entry point. | |
main :: IO () | |
main = do | |
putStrLn "Welcome to FP Haskell Center!" | |
putStrLn "Have a good day!" | |
putStrLn $ show $ middle [1] | |
putStrLn $ show $ middle [1,2] |
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 MagicHash #-} | |
-- | Main entry point to the application. | |
module Main where | |
import GHC.Exts | |
-- | The main entry point. | |
main :: IO () | |
main = do | |
putStrLn $ showUnboxedInt 1# |
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
/** | |
* Created by claramun on 6/9/14. | |
*/ | |
trait A | |
trait B { val value:String } | |
trait X1A extends A | |
trait X1B extends B |
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
#lang scheme | |
(define atom? (let ((f1 pair?) (f2 not)) (lambda (x) (f2 (f1 x))))) | |
(define lat? | |
(lambda (lat) | |
(cond | |
((null? lat) #t) | |
((atom? (car lat)) (lat? (cdr lat))) | |
(else #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
abstract class MyTry[T] { | |
def get: T | |
def flatMap[U](f: T => MyTry[U]): MyTry[U] | |
def map[U](f: T => U): MyTry[U] | |
def filter(p: T => Boolean)(implicit msg:Msg[T]): MyTry[T] | |
} | |
object MyTry { | |
def apply[T](r: => T): MyTry[T] = |
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 | |
object Regular1 { | |
trait Bifunctor[F[_, _]] { | |
def bimap[A, R, B, S](fa: F[A, R], f: A => B, g: R => S): F[B, S] | |
} | |
trait Regular2[T[_]]{ | |
def from2[A,PF2[_,_]]:T[A]=>PF2[A,T[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
https://github.com/fedesilva/tm2013-hello-play-scala.git | |
https://github.com/fedesilva/tm2013-hello-akka.git | |
https://github.com/fedesilva/tm2013-reactive-stocks.git |