This is my recommended path for learning Haskell.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ************** 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 | |
-------- |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- 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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{- | |
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.) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{-# 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) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{-# 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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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)))))), |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
! 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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;mac swap win+alt | |
;RWin::RAlt | |
;LWin::LAlt | |
;RAlt::RWin | |
;LAlt::LWin | |
;mac swap win+alt+ctrl | |
LAlt::LWin | |
RAlt::RWin | |
RWin::RCtrl |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{-# LANGUAGE PatternGuards, DeriveDataTypeable #-} | |
module Control.Exception.IOErrors where | |
import Data.Typeable | |
import Control.Exception | |
import System.IO.Error | |
data AlreadyExists = AlreadyExists IOError deriving Typeable |
OlderNewer