Skip to content

Instantly share code, notes, and snippets.

@absurdhero
absurdhero / Parser.kt
Last active March 20, 2018 11:44
monadic parser combinator in Kotlin
package net.raboof.parser
// based on http://blogs.msdn.com/b/lukeh/archive/2007/08/19/monadic-parser-combinators-using-c-3-0.aspx
data class Result<TInput, TValue>(val value: TValue, val rest: TInput)
class Parser<TInput, TValue>(val f: (TInput) -> Result<TInput, TValue>?) {
operator fun invoke(input: TInput): Result<TInput, TValue>? = f(input)
infix fun or(other: Parser<TInput, TValue>): Parser<TInput, TValue> {
@absurdhero
absurdhero / test_results.html
Created July 31, 2013 04:37
MonoGame MonoMac test failures
<!DOCTYPE html>
<html>
<head>
<META http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>MonoGame.Tests.MacOS</title>
<style>
.plus {
display: inline-block;