Skip to content

Instantly share code, notes, and snippets.

author :: Parser Author
author = between parens (many anyChar) <* eol
title :: Parser Title
title = do
t <- endBy anyChar (optional author)
mA <- optional author
pure $ Title t mA
@mankyKitty
mankyKitty / Makefile
Last active July 31, 2016 07:02
Levelling up my make skills.
REVISION := 1.wut
ARCH := x86_64
PRJ := $(shell basename $(shell pwd))
CABAL := $(PRJ).cabal
VER := $(shell awk '/^version:/{ print $$2 }' $(CABAL))
MAINTAINER := $(shell awk '/^maintainer:/{ print $$2 }' $(CABAL))
trait HasAString[A] {
def getTheString( a: A ): String
}
// This shenanigan has been pulled from Scalaz Functor definition
object HasAString {
@inline def apply[A](implicit a:HasAString[A]): HasAString[A] = a
}
@mankyKitty
mankyKitty / Wut.scala
Last active June 16, 2016 04:43
Scala - Argonaut - FUNfiltered
// The Argonaut docs are quite good at showing how to setup
// the various instances that power all of this jazz, but for
// the sake of discussion I'll include one of the simplest ones
// for just whipping up the required implicits.
final case class Wibble (
id: Double, // Because MUAHAHAHAHA
wut: String,
wat: List[Int]
)
@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) {
@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 / .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 / 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 / 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 / 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