nar 0.0.8

Narc, a dependently-typed programming language with dependent pattern matching
Documentation
pub use self::{block::*, core::*, mat::*};

/// Reduction blocking status
mod block;
mod core;
/// Match patterns.
mod mat;

/// `Simplification` in
/// [Agda](https://hackage.haskell.org/package/Agda-2.6.0.1/docs/src/Agda.TypeChecking.Monad.Base.html#Simplification).
#[derive(Ord, PartialOrd, Eq, PartialEq, Copy, Clone, Debug, Hash)]
pub enum Simpl {
    Yes,
    No,
}

impl From<bool> for Simpl {
    fn from(b: bool) -> Self {
        if b {
            Simpl::Yes
        } else {
            Simpl::No
        }
    }
}

impl Into<bool> for Simpl {
    fn into(self) -> bool {
        match self {
            Simpl::Yes => true,
            Simpl::No => false,
        }
    }
}

impl Default for Simpl {
    fn default() -> Self {
        Simpl::No
    }
}

impl std::ops::Add for Simpl {
    type Output = Self;

    fn add(self, rhs: Self) -> Self::Output {
        match self {
            Simpl::Yes => Simpl::Yes,
            Simpl::No => rhs,
        }
    }
}

/// Reduce Monad.
pub type RedM<Ok, Err> = Result<(Simpl, Ok), Err>;

#[cfg(test)]
mod tests;