AlgoRhythm-0.1.0.0: Algorithmic music composition

Safe HaskellNone
LanguageHaskell2010

Utils.Peano

Description

Can be used to encode natural numbers as types.

Synopsis

Documentation

data Nat Source #

Typelevel Peano numbers.

Constructors

Z

Zero

S Nat

Successor

Instances

Show Nat Source # 

Methods

showsPrec :: Int -> Nat -> ShowS #

show :: Nat -> String #

showList :: [Nat] -> ShowS #

data SNat n where Source #

Singleton definition for Nat

Constructors

SZ :: SNat Z 
SS :: SNat n -> SNat (S n) 

derivePeanoAliases Source #

Arguments

:: Integer

X, the maximum decimal type alias.

-> Q [Dec] 

Derives type aliases D0, D1, ..., DX, where Da is equivalent to the decimal number a, written as a Peano number.

toInt :: Nat -> Int Source #

Converts a Nat to its Int representation.

toNat :: Int -> Nat Source #

Converts an Int to its Nat representation.