The goal of this talk is to introduce the Write Yourself a Scheme book to a new audience. I found this book to be incredibly instructive as a Haskeller moving from tiny programs into non-trivial applications. I would like to present it as not only a great project in its own right. But it is a tremendous starting point for learning more advanced concepts and experimenting with Haskell packages.
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
-- This is just a crackpot idea of possibly polymorphic / type class constrained | |
-- functions over an Object or record. This is unproven and only got so far as | |
-- seeing if it type checks, not necessarily if it's of any use... | |
-- Just use lenses... | |
-- Type checks but not sure it actually makes any sense... | |
foo :: forall a b f r. (Functor f) => Object ( b :: f a | r) -> a -> Object ( b :: f a | r) | |
foo o a' = o -- yeah I really don't think this is useful | |
-- However this doesn't make any sense since the field names are | |
-- used literally so if you don't have 'o.a' on your input object | |
-- then it's not going to work. |
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
// Start Pie Chart | |
$pieSize: 20px; | |
.pieContainer { | |
height: $pieSize; | |
} | |
.pieSize { | |
width: $pieSize; | |
height: $pieSize; |
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
fun isEmpty (v : string) = if v = "" | |
then <xml><p>Field is required!</p></xml> | |
else <xml/> | |
fun main () = | |
s <- source ""; | |
return <xml><body> | |
<ctextbox source={s}/> <br/> | |
<dyn signal={a <- signal s; return <xml>You entered: {[a]}</xml>}/> <br/> | |
<dyn signal={a <- signal s; return (isEmpty a)}/> <br/> |
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
datatype notlist a = NotNil | NotCons of (a * notlist a) | |
signature NOTFUNCTOR = sig | |
class notfunctor :: (Type -> Type) -> Type | |
val fmap : f :: (Type -> Type) -> a ::: Type -> b ::: Type -> (a -> b) -> f a -> f b | |
val mkNF : f ::: (Type -> Type) -> (a ::: Type -> b ::: Type -> (a -> b) -> f a -> f b) -> notfunctor (f) | |
val notfunctor_notlist : notfunctor notlist | |
end |
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
#!/usr/bin/env rc | |
TERM=dumb | |
SHELL=rc | |
BROWSER=google-chrome | |
fontsrv & | |
plumber | |
tabstop=2 |
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
datatype notlist a = NotNil | NotCons of (a * notlist a) | |
structure Pointed : sig | |
class pointed :: (Type -> Type) -> Type | |
val point : a ::: Type -> f ::: (Type -> Type) | |
-> pointed f | |
-> a -> f a | |
val mkPointed : f ::: (Type -> Type) |
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
python from powerline.vim import setup as powerline_setup | |
python powerline_setup() | |
python del powerline_setup | |
set nowrap | |
set wildmode=list:longest | |
" Change cursor in iTerm on insert | |
" let &t_SI = "\<Esc>]50;CursorShape=1\x7" | |
" let &t_EI = "\<Esc>]50;CursorShape=0\x7" |
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
import Control.Lens.Cons (Cons (..), cons, (<|)) | |
import Data.Maybe (maybe) | |
import Data.Monoid (Monoid) | |
unfoldM :: (Cons s s a a, Monoid s, Monad m) => (b -> m (Maybe (a,b))) -> b -> m s | |
unfoldM f b = maybe (return mempty) (\(a,b') -> cons a <$> unfoldM f b') =<< f b |
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
exports.drawImageFinalForm = function(ctx) { | |
return function(elem) { | |
return function(dx) { | |
return function(dy) { | |
return function(dw) { | |
return function(dh) { | |
return function(sx) { | |
return function(sy) { | |
return function(sw) { | |
return function(sh) { |