This file contains hidden or 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
/// The Identity Monad. | |
/// the one that shoves in! | |
//ploki@blackmilk.fr | |
use std::ops::Shr; | |
// The Monad trait introduces the monadic bind | |
trait Monad<A, F> { | |
type Output; | |
fn then(self, f: F) -> Self::Output; | |
} |
This file contains hidden or 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
/// Parser Monad Combinators | |
/// https://www.cs.nott.ac.uk/~pszgmh/monparsing.pdf | |
//ploki@blackmilk.fr | |
use std::env; | |
use std::fs; | |
use std::ops::{Add, Deref, Shr}; | |
use std::sync::Arc; | |
#[derive(Clone)] | |
struct Interpretation<'a, A>(A, &'a str); |
This file contains hidden or 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
//ploki@blackmilk.fr | |
use std::collections::HashMap; | |
use std::hash::Hash; | |
use std::fmt::Debug; | |
use std::ops::{BitOr,Shr,Mul,Add}; | |
#[derive(Debug, Clone, PartialEq)] | |
struct Dist<A> | |
where | |
A: Eq + Hash + Clone + Debug, |