Skip to content

Instantly share code, notes, and snippets.

@absurdhero
absurdhero / Parser.kt
Last active Mar 20, 2018
monadic parser combinator in Kotlin
View Parser.kt
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 Jul 31, 2013
MonoGame MonoMac test failures
View test_results.html
<!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;