Skip to content

Instantly share code, notes, and snippets.

Avatar
🦈
Baabyyy Shark tu tu ru tu tu tu

Roman Gonzalez roman

🦈
Baabyyy Shark tu tu ru tu tu tu
View GitHub Profile
@roman
roman / mvar.rs
Created Aug 18, 2019
Fun exercise of implementing Haskell's MVar in Rust
View mvar.rs
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>
View golang_sprintf_luxury.go
package main
import (
// "fmt"
"fmt"
"strings"
"testing"
)
// type Greeter interface {
@roman
roman / keybase.md
Last active May 13, 2018
Proof for keybase to prove my identity on github
View keybase.md

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 Feb 10, 2018
Playing around with Type families and Constraint kinds
View Example.lhs
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 Jan 9, 2018
Snapshot of library skeleton for Haskell Projects
View lib.hsfiles
{-# 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)
View Lib.hs
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
View Lib.hs
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
View Lib.hs
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)
View corageous-and-delightful-development-with-elm.org

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 Aug 29, 2015
Implementation of Free Monads using bwo's Monads library
View free.clj
(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]