- C-a == Ctrl-a
- M-a == Alt-a
:q close
:w write/saves
:wa[!] write/save all windows [force]
:wq write/save and close
| # unregister broken GHC packages. Run this a few times to resolve dependency rot in installed packages. | |
| # ghc-pkg-clean -f cabal/dev/packages*.conf also works. | |
| function ghc-pkg-clean() { | |
| for p in `ghc-pkg check $* 2>&1 | grep problems | awk '{print $6}' | sed -e 's/:$//'` | |
| do | |
| echo unregistering $p; ghc-pkg $* unregister $p | |
| done | |
| } | |
| # remove all installed GHC/cabal packages, leaving ~/.cabal binaries and docs in place. |
| {-# LANGUAGE ScopedTypeVariables #-} | |
| import Reflex.Dom | |
| import GHCJS.DOM.CanvasRenderingContext2D (putImageData, setFillStyle, fillRect) | |
| import GHCJS.DOM.HTMLCanvasElement (getContext) | |
| import GHCJS.DOM.ImageData (newImageData') | |
| import Control.Monad.IO.Class (liftIO) | |
| import GHCJS.DOM.Types (CanvasStyle(..), CanvasRenderingContext2D(..), toJSString, castToHTMLCanvasElement) | |
| import GHCJS.Marshal (toJSVal) | |
| import Data.Time (getCurrentTime) |
| ps = [] : map parts [1..] | |
| where parts n = [n] : [x : p | x <- [1..n], p <- ps !! (n - x), x <= head p] |
| {-# LANGUAGE LambdaCase, DeriveGeneric, NamedFieldPuns, RecordWildCards, OverloadedStrings #-} | |
| module Main where | |
| import Pipes | |
| import qualified Pipes.Prelude as P | |
| import Pipes.Network.TCP | |
| import qualified Data.ByteString as B | |
| import qualified Data.HashTable.IO as H | |
| import System.IO.Unsafe | |
| import Data.Serialize |
| {-# LANGUAGE LambdaCase #-} | |
| import Control.Applicative | |
| import Control.Monad.State | |
| import System.Random | |
| data Tree a = Empty | Bin a (Tree a) (Tree a) | |
| deriving Show | |
| -- O(n) |
| {-# LANGUAGE GADTs #-} | |
| import Data.Char (digitToInt) | |
| data Nil | |
| data Cons a b | |
| data Pipeline ts a c where | |
| (:>) :: (a -> b) -> Pipeline ts b c -> Pipeline (Cons (a -> b) ts) a c | |
| Id :: Pipeline Nil t t |
This is a summary of the "Learn You A Haskell" online book under http://learnyouahaskell.com/chapters.
| <!DOCTYPE html> | |
| <html> | |
| <head> | |
| <script language="javascript" src="lib.js"></script> | |
| <script language="javascript" src="rts.js"></script> | |
| <script language="javascript" src="lib1.js"></script> | |
| <script language="javascript" src="out.js"></script> | |
| </head> | |
| <body> | |
| <canvas id="mycanvas" width="600" height="400"></canvas> |