Skip to content

Instantly share code, notes, and snippets.

@jonschoning
jonschoning / LiveCoding Instructions
Last active August 28, 2015 01:49 — forked from devx00/LiveCoding Instructions
Instructions to setup external streaming and chatting for livecoding.tv streams
// ************** Instructions for connecting to the LiveCoding chatrooms from a 3rd party application. ****************
Step 1a (Ubuntu/ any OS with aptitude (aka apt-get)) :
sudo apt-add-repository ppa:rsrchboy/profanity && sudo apt-get update
apt-get install profanity
--
Step 1b (OSX w/ homebrew):
$ brew install profanity
--------
-- http://stackoverflow.com/questions/7828072/how-does-haskell-printf-work
{-# LANGUAGE FlexibleInstances #-}
class FooType a where
bar :: IO () -> a
instance FooType (IO ()) where
bar = id
{-
http://www.reddit.com/r/haskell/comments/cs54i/how_would_you_write_du_in_haskell/c0uvqqo
That pattern is called a "hylomorphism", and is one of the more common
recursion schemes. It can always be simplified into fold . unfold because
the mapped function can be pushed into the arguments on either side. For
pedagogical/clarity reasons it can be worth keeping it factored out, if you
so desire. (It can also be worth factoring out a natural transformation to
convert the functor you unfold into a different functor for folding, cf.
category-extras.)
{-# LANGUAGE DeriveFunctor #-}
data ExprF r = Const Int
| Add r r
| Mul r r
deriving Functor
newtype Fix f = Fx (f (Fix f))
unFix :: Fix f -> f (Fix f)
{-# LANGUAGE DeriveFunctor #-}
data ExprF r = Const Int
| Add r r
| Mul r r
deriving Functor
newtype Fix f = Fx (f (Fix f))
val :: Fix ExprF
let f x = (x,x); f1 x = f (f x); f2 x = f1 (f1 x); f3 x = f2 (f2 x) in f3
:: t
-> ((((((((t, t), (t, t)), ((t, t), (t, t))),
(((t, t), (t, t)), ((t, t), (t, t)))),
((((t, t), (t, t)), ((t, t), (t, t))),
(((t, t), (t, t)), ((t, t), (t, t))))),
(((((t, t), (t, t)), ((t, t), (t, t))),
(((t, t), (t, t)), ((t, t), (t, t)))),
((((t, t), (t, t)), ((t, t), (t, t))),
(((t, t), (t, t)), ((t, t), (t, t)))))),
! replace Capslock with Control_L
keycode 66 = Alt_L
clear Lock
add Control = Alt_L
clear control
clear mod1
keycode 37 = Alt_L Meta_L
keycode 64 = Control_L
add control = Control_L Control_R

https://gist.github.com/bitemyapp/8739525

This is my recommended path for learning Haskell.

Something to keep in mind: don't sweat the stuff you don't understand immediately. Just keep moving.

Primary course

Installing Haskell

;mac swap win+alt
;RWin::RAlt
;LWin::LAlt
;RAlt::RWin
;LAlt::LWin
;mac swap win+alt+ctrl
LAlt::LWin
RAlt::RWin
RWin::RCtrl
{-# LANGUAGE PatternGuards, DeriveDataTypeable #-}
module Control.Exception.IOErrors where
import Data.Typeable
import Control.Exception
import System.IO.Error
data AlreadyExists = AlreadyExists IOError deriving Typeable