advent-0.1.0.0: Advent of Code common library
Copyright(c) Eric Mertens 2021
LicenseISC
Maintaineremertens@gmail.com
Safe HaskellSafe-Inferred
LanguageHaskell2010

Advent.Nat

Description

 
Synopsis

Documentation

data Nat Source #

Natural numbers (used for type index)

Constructors

Z

zero

S Nat

successor

type family FromNatural (n :: Natural) :: Nat where ... Source #

Covert from GHC type literal syntax to an inductively defined natural

Equations

FromNatural 0 = 'Z 
FromNatural n = 'S (FromNatural (n - 1)) 

class UnfoldNat (n :: Nat) where Source #

Methods

unfoldNat :: f 'Z -> (forall (m :: Nat). f m -> f ('S m)) -> f n Source #

Instances

Instances details
UnfoldNat 'Z Source # 
Instance details

Defined in Advent.Nat

Methods

unfoldNat :: f 'Z -> (forall (m :: Nat). f m -> f ('S m)) -> f 'Z Source #

UnfoldNat n => UnfoldNat ('S n) Source # 
Instance details

Defined in Advent.Nat

Methods

unfoldNat :: f 'Z -> (forall (m :: Nat). f m -> f ('S m)) -> f ('S n) Source #