Skip to content

Instantly share code, notes, and snippets.

View roman's full-sized avatar

Roman Gonzalez roman

View GitHub Profile
@roman
roman / mvar.rs
Created August 18, 2019 21:46
Fun exercise of implementing Haskell's MVar in Rust
use std::sync::{Condvar, Mutex};
pub struct MVar<T> {
locked_value: Mutex<Option<T>>,
empty_cond: Condvar,
full_cond: Condvar,
}
// Methods of MVar that need the Clone type constraint
impl<T> MVar<T>
package main
import (
// "fmt"
"fmt"
"strings"
"testing"
)
// type Greeter interface {
@roman
roman / keybase.md
Last active May 13, 2018 14:54
Proof for keybase to prove my identity on github

Keybase proof

I hereby claim:

  • I am roman on github.
  • I am romanandreg (https://keybase.io/romanandreg) on keybase.
  • I have a public key ASAvDKNxvV3MbARSw0PrDLl-EggvvoUXWuOeXOm1igAWbQo

To claim this, I am signing this object:

@roman
roman / Example.lhs
Last active February 10, 2018 23:15
Playing around with Type families and Constraint kinds
In this example we are using both *TypeFamilies* and *ConstraintKinds* to create a monadic
interface that keeps track of valid state transitions.
This is an evolution from @pittma experiments from the #haskell channel on the Functional Programming slack
> {-# LANGUAGE GADTs #-}
> {-# LANGUAGE DataKinds #-}
> {-# LANGUAGE StandaloneDeriving #-}
> {-# LANGUAGE MultiParamTypeClasses #-}
> {-# LANGUAGE RankNTypes #-}
@roman
roman / lib.hsfiles
Last active January 9, 2018 21:14
Snapshot of library skeleton for Haskell Projects
{-# START_FILE README.md #-}
# {{name}}
> Description of what this library does
## Table Of Contents
* [Raison d'etre](#raison-detre)
* [Library Usage](#library-usage)
* [Installation](#installation)
* [Development Notes](#development)
@roman
roman / Lib.hs
Last active February 5, 2017 00:13
module Main where
import Control.Applicative
import Control.Monad
import Data.List (foldl')
import qualified Data.Sequence as Seq
import qualified Data.Vector (freeze)
import qualified Data.Vector.Unboxed as V
import qualified Data.Vector.Unboxed.Mutable as VM
@roman
roman / Lib.hs
Last active February 4, 2017 23:14
module Main where
import Data.List (sort, sortBy)
import Control.Applicative
import Control.Monad (forM, replicateM_)
import Data.Set (Set)
import qualified Data.Set as Set
import qualified Data.Sequence as Seq
import qualified Data.Vector (freeze)
import qualified Data.Vector.Unboxed as V
module Main where
import Control.Applicative
import Control.Monad (forM, replicateM_)
import qualified Data.Vector (freeze)
import qualified Data.Vector.Unboxed as V
import qualified Data.Vector.Unboxed.Mutable as VM
mkPolygonVector :: IO (V.Vector Int)

Brave and Delightful development with Elm

Roman Gonzalez will introduce Elm, an opinionated language that is inspired on a simplified Haskell syntax. Elm provides all the guarantees that good statically typed languages give, plus:

@roman
roman / free.clj
Last active August 29, 2015 14:24
Implementation of Free Monads using bwo's Monads library
(ns util.monads.free
(:require [monads.core :refer :all]
[monads.types :as types]
[clojure.core.match :refer [match]]
[clojure.algo.generic.functor :refer [fmap]]))
(defrecord Free [type functor-value])
(defn pure [val]