Skip to content

Instantly share code, notes, and snippets.

View counter.scala
class Counter(val count: Int = 0) {
def inc = new Counter(count + 1)
def dec = new Counter(count - 1)
}
View Vagrantfile
# -*- mode: ruby -*-
# vi: set ft=ruby :
# All Vagrant configuration is done below. The "2" in Vagrant.configure
# configures the configuration version (we support older styles for
# backwards compatibility). Please don't change it unless you know what
# you're doing.
Vagrant.configure("2") do |config|
# The most common configuration options are documented and commented below.
# For a complete reference, please see the online documentation at
View Vagrantfile
# -*- mode: ruby -*-
# vi: set ft=ruby :
# All Vagrant configuration is done below. The "2" in Vagrant.configure
# configures the configuration version (we support older styles for
# backwards compatibility). Please don't change it unless you know what
# you're doing.
Vagrant.configure("2") do |config|
# The most common configuration options are documented and commented below.
# For a complete reference, please see the online documentation at
View provision.sh
sudo apt-get install python3-setuptools
sudo easy_install3 pip # will be a Python3 pip
sudo pip install virtualenv # will be py3
View rt.md

An expression is said to be referentially transparent if it can be replaced with its value without changing the behavior of a program (in other words, yielding a program that has the same effects and output on the same input)

https://en.wikipedia.org/wiki/Referential_transparency

This example is taken from the book "Functional Programming in Scala"

The following is referentially transparent:

scala> val x = "hello, world"
@levinotik
levinotik / playground.rs
Created Apr 10, 2016 — forked from anonymous/playground.rs
Shared via Rust Playground
View playground.rs
fn main() {
// No good because we move v to v2
// which creates a copy of the pointer
// which means we have two pointers
// to the content of the vector on the heap
// this violates safety guarantees
// by introducing a data race
// therefore Rust forbids using v after the move
@levinotik
levinotik / Folds.hs
Created Jan 19, 2016
Explicit recursion vs Folding
View Folds.hs
module Folding where
import Prelude hiding (length, sum, maximum, elem, null, product, reverse, all, any, (++), map, init, filter)
sum :: Num a => [a] -> a
sum [] = 0
sum (x:xs) = x + sum xs
sum' :: Num a => [a] -> a
sum' = foldl (+) 0
View TransformersPart1.hs
module TransformersPart1 where
import Control.Monad.Trans.Maybe
import Data.Functor
import Text.Read (readMaybe)
-- plain old Maybe example (avoiding division by zero)
ex1 :: Int -> Int -> Maybe Int
ex1 x y | y > 0 = Just (x `div` y)
| otherwise = Nothing
View gist:58ac52f462891aad20ad

Hey there,

As a relatively new Haskell user, I've been pretty disappointed with the state of haskell.org. I know I'm preaching to the choir here, but with large portions of the site currently inaccessible and others taking an unreasonable amount of time to load (at least up until recently), haskell.org is far from usable. Members of #haskell-infrastructure were kind enough to answer some of my questions yesterday when I was trying to get the lay of the land and understand how things work and what the current process it. I know that there's currently a loose confederation of volunteers working on haskell.org as with any open-source project and I wanted to see how I might be able to help.

I have experience with devops -- not a ton, but enough. It may very well be that there's nothing I can help with and that everyone is already familiar with the issues and working on them. However, if part of the issue is lack of time then I'm here to offer some. I seem to be hearing people in #haskell-infrastructure say tha

View gist:223415b1224e27786c4a
Hey there,
As a relatively new Haskell user, I've been pretty disappointed with the state of haskell.org. I know I'm preaching to the choir here, but with large portions of the site currently inaccessible and others taking an unreasonable amount of time to load (at least up until recently), haskell.org is far from usable. Members of #haskell-infrastructure were kind enough to answer some of my questions yesterday when I was trying to get the lay of the land and understand how things work and what the current process it. I know that there's currently a loose confederation of volunteers working on haskell.org as with any open-source project and I wanted to see how I might be able to help.
I have experience with devops -- not a ton, but enough. It may very well be that there's nothing I can help with and that everyone is already familiar with the issues and working on them. However, if part of the issue is time then I'm here to offer some. I seem to be hearing people in #haskell-infrastructure say that they'r
You can’t perform that action at this time.