Skip to content

Instantly share code, notes, and snippets.

View trylks's full-sized avatar
🤖
Automating

trylks trylks

🤖
Automating
View GitHub Profile
@sortega
sortega / ForFree.scala
Created October 3, 2016 16:19
I informally demoed the concept of Free monad to a colleague and he asked for the code. I've added a couple comments to make it standalone.
package experiments
import scala.concurrent.ExecutionContext.Implicits.global
import scala.concurrent.{Await, Future}
import scalaz._
import Scalaz._
import scala.concurrent.duration.Duration
import natural.TypeSafeMap
@apoloval
apoloval / guessing.rs
Created February 24, 2015 08:36
A number guessing kata implemented in Rust
use std::cmp::Ordering;
use std::io;
use std::os;
use std::rand;
static PICK_RANGE: u32 = 5;
enum Command { Pick, Guess }
fn parse_command(from: &str) -> Option<Command> {
@sortega
sortega / warrior.hs
Created February 23, 2015 22:58
Improvement over naive.hs
import Control.Monad.Random
import Data.List
import System.Environment
import System.Exit
import System.Random
import System.IO
data Feedback = Smaller | Bigger | Done deriving (Show, Eq)
type Guess = Int
type Range = (Int, Int)