Skip to content

Instantly share code, notes, and snippets.

@mankyKitty
mankyKitty / Madness.purs
Created February 23, 2015 00:06
Some madness regarding things that type check but probably aren't sensible...
-- 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.
@mankyKitty
mankyKitty / PieChart.scss
Created February 26, 2015 00:20
Pie chart using only CSS, or SCSS in this case.
// Start Pie Chart
$pieSize: 20px;
.pieContainer {
height: $pieSize;
}
.pieSize {
width: $pieSize;
height: $pieSize;
@mankyKitty
mankyKitty / WYAS_Redux.md
Last active August 29, 2015 14:17
Possible talk for LJ 2015

Write Yourself a Scheme Redux

Goal

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.

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/>
@mankyKitty
mankyKitty / hask_functor.ur
Created April 9, 2015 12:48
Yeahhhhh, I have no idea what I'm doing here.. Haskell Functor type class in UrWeb ? .
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
@mankyKitty
mankyKitty / acme.rc
Created April 26, 2015 10:56
My Acme starter
#!/usr/bin/env rc
TERM=dumb
SHELL=rc
BROWSER=google-chrome
fontsrv &
plumber
tabstop=2
@mankyKitty
mankyKitty / yep.ur
Created April 30, 2015 11:44
So that happened....
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)
@mankyKitty
mankyKitty / .vimrc
Created May 4, 2015 05:59
vimrc dot file baseline.
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"
@mankyKitty
mankyKitty / UnfoldM.hs
Last active January 7, 2016 10:42
An effect permitting unfold ???
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
@mankyKitty
mankyKitty / rawr.js
Created January 10, 2016 09:17
Purescript FFI shenanigans
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) {