{-# language DataKinds #-}
{-# language DerivingStrategies #-}
{-# language ExplicitNamespaces #-}
{-# language GADTSyntax #-}
{-# language GeneralizedNewtypeDeriving #-}
{-# language KindSignatures #-}
{-# language RoleAnnotations #-}
{-# language StandaloneDeriving #-}
{-# language TypeOperators #-}
module Arithmetic.Unsafe
( Nat(..)
, type (<)(Lt)
, type (<=)(Lte)
, type (:=:)(Eq)
) where
import Prelude hiding ((>=),(<=))
import Control.Category (Category)
import Data.Kind (Type)
import qualified Control.Category
import qualified GHC.TypeNats as GHC
infix 4 <
infix 4 <=
infix 4 :=:
newtype Nat (n :: GHC.Nat) = Nat { getNat :: Int }
type role Nat nominal
deriving newtype instance Show (Nat n)
data (<) :: GHC.Nat -> GHC.Nat -> Type where
Lt :: a < b
data (<=) :: GHC.Nat -> GHC.Nat -> Type where
Lte :: a <= b
data (:=:) :: GHC.Nat -> GHC.Nat -> Type where
Eq :: a :=: b
instance Category (<=) where
id = Lte
Lte . Lte = Lte
instance Category (:=:) where
id = Eq
Eq . Eq = Eq