Note: you can copy the file 2-lenses.js
below over to repl.it and
play along from home!
A lens in programming, much like a lens in the real world, allows you to focus in on a small part of a larger whole and then do something with or to
#!/bin/bash | |
# source: http://www.haskell.org/pipermail/haskell-cafe/2011-March/090170.html | |
sudo rm -rf /Library/Frameworks/GHC.framework | |
sudo rm -rf /Library/Frameworks/HaskellPlatform.framework | |
sudo rm -rf /Library/Haskell | |
rm -rf ~/.cabal | |
rm -rf ~/.ghc | |
rm -rf ~/Library/Haskell |
Note: you can copy the file 2-lenses.js
below over to repl.it and
play along from home!
A lens in programming, much like a lens in the real world, allows you to focus in on a small part of a larger whole and then do something with or to
Or: functor? I 'ardly know 'er!
Monads are difficult to explain without sounding either patronizing or condescending: I would sound patronizing if I came up with some facile analogy and I would be condescending to describe it categorically.
Instead, I'll frame a problem and piece-by-piece solve the problem with what will turn out to be a monad.
{-# LANGUAGE DeriveFunctor #-} | |
{-# LANGUAGE GeneralizedNewtypeDeriving #-} | |
import Prelude hiding (not,and,log) | |
import Control.Monad | |
import Control.Monad.State | |
import Control.Monad.Free | |
import Control.Monad.Trans | |
import Control.Monad.Writer | |
import qualified Data.Vector.Unboxed as U |
#!/bin/bash | |
MEDIA_FILE="$1" | |
if [ -z "$1" ]; then | |
echo "Please specify a media file as the first argument." | |
exit 1 | |
fi | |
CHROMECAST_IP4_ADDRESS="$2" |
'use strict'; | |
let str = "the quick brown fox jumps over the lazy dog"; | |
let fw = Array.prototype.map | |
.call(str, (c) => c === ' ' | |
? ' ' | |
: String.fromCodePoint(c.codePointAt(0) + 0xFEE0)) | |
.join(''); | |
console.log(fw); |
-- This is going to be on Hackage soon! https://github.com/gatlin/surely | |
{-# LANGUAGE BangPatterns #-} | |
-- | | |
-- Module : AI.Surely | |
-- Copyright : 2012 Gatlin Johnson | |
-- License : LGPL 3.0 | |
-- Maintainer : rokenrol@gmail.com | |
-- Stability : experimental |
How to add imperative programming to a pure functional language | |
=== | |
Many people bemoan languages such as Haskell for not supporting imperative | |
programming; they decry the need for math in their computer science. | |
![Math? In my computer? Yeah right.](http://i.imgur.com/YDIaEPB.jpg) | |
I'm here to tell you that not only does Haskell make imperative programming a | |
cinch, but safe and correct as well. Follow along! This post is written in |
#!/usr/bin/env bash | |
############################ | |
# Unicode Character Viewer # | |
# v1.0 # | |
# ~*~*~*~*~*~*~*~*~*~*~*~* # | |
# Author: Gatlin Johnson # | |
# <gatlin@niltag.net> # | |
# ~*~*~*~*~*~*~*~*~*~*~*~* # | |
# Runtime dependencies: # | |
# - fzf # |
I hereby claim:
To claim this, I am signing this object: