laop-0.1.0.7

Safe HaskellNone
LanguageHaskell2010

LAoP.Utils.Internal

Contents

Synopsis

Natural data type

newtype Natural (start :: Nat) (end :: Nat) Source #

Wrapper around Ints that have a restrictive semantic associated. A value of type Natural n m can only be instanciated with some Int i that's n <= i <= m.

Constructors

Nat Int 
Instances
(KnownNat n, KnownNat m) => Bounded (Natural n m) Source # 
Instance details

Defined in LAoP.Utils.Internal

Methods

minBound :: Natural n m #

maxBound :: Natural n m #

(KnownNat n, KnownNat m) => Enum (Natural n m) Source # 
Instance details

Defined in LAoP.Utils.Internal

Methods

succ :: Natural n m -> Natural n m #

pred :: Natural n m -> Natural n m #

toEnum :: Int -> Natural n m #

fromEnum :: Natural n m -> Int #

enumFrom :: Natural n m -> [Natural n m] #

enumFromThen :: Natural n m -> Natural n m -> [Natural n m] #

enumFromTo :: Natural n m -> Natural n m -> [Natural n m] #

enumFromThenTo :: Natural n m -> Natural n m -> Natural n m -> [Natural n m] #

Eq (Natural start end) Source # 
Instance details

Defined in LAoP.Utils.Internal

Methods

(==) :: Natural start end -> Natural start end -> Bool #

(/=) :: Natural start end -> Natural start end -> Bool #

(KnownNat n, KnownNat m) => Num (Natural n m) Source #

Throws a runtime error if any of the operations overflows or underflows.

Instance details

Defined in LAoP.Utils.Internal

Methods

(+) :: Natural n m -> Natural n m -> Natural n m #

(-) :: Natural n m -> Natural n m -> Natural n m #

(*) :: Natural n m -> Natural n m -> Natural n m #

negate :: Natural n m -> Natural n m #

abs :: Natural n m -> Natural n m #

signum :: Natural n m -> Natural n m #

fromInteger :: Integer -> Natural n m #

Ord (Natural start end) Source # 
Instance details

Defined in LAoP.Utils.Internal

Methods

compare :: Natural start end -> Natural start end -> Ordering #

(<) :: Natural start end -> Natural start end -> Bool #

(<=) :: Natural start end -> Natural start end -> Bool #

(>) :: Natural start end -> Natural start end -> Bool #

(>=) :: Natural start end -> Natural start end -> Bool #

max :: Natural start end -> Natural start end -> Natural start end #

min :: Natural start end -> Natural start end -> Natural start end #

Read (Natural start end) Source # 
Instance details

Defined in LAoP.Utils.Internal

Methods

readsPrec :: Int -> ReadS (Natural start end) #

readList :: ReadS [Natural start end] #

readPrec :: ReadPrec (Natural start end) #

readListPrec :: ReadPrec [Natural start end] #

Show (Natural start end) Source # 
Instance details

Defined in LAoP.Utils.Internal

Methods

showsPrec :: Int -> Natural start end -> ShowS #

show :: Natural start end -> String #

showList :: [Natural start end] -> ShowS #

Generic (Natural start end) Source # 
Instance details

Defined in LAoP.Utils.Internal

Associated Types

type Rep (Natural start end) :: Type -> Type #

Methods

from :: Natural start end -> Rep (Natural start end) x #

to :: Rep (Natural start end) x -> Natural start end #

NFData (Natural start end) Source # 
Instance details

Defined in LAoP.Utils.Internal

Methods

rnf :: Natural start end -> () #

type Rep (Natural start end) Source # 
Instance details

Defined in LAoP.Utils.Internal

type Rep (Natural start end) = D1 (MetaData "Natural" "LAoP.Utils.Internal" "laop-0.1.0.7-DQmfXIQJBtQ2E7r3llsX41" True) (C1 (MetaCons "Nat" PrefixI False) (S1 (MetaSel (Nothing :: Maybe Symbol) NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 Int)))

nat :: forall n m. (KnownNat n, KnownNat m) => Int -> Natural n m Source #

Natural constructor function. Throws a runtime error if the Int value is greater than the corresponding m or lower than n in the Natural n m type.

Coerce auxiliar functions to help promote Int typed functions to

coerceNat :: (Int -> Int -> Int) -> Natural a a' -> Natural b b' -> Natural c c' Source #

Auxiliary function that promotes binary Int functions to Natural binary functions.

coerceNat2 :: ((Int, Int) -> Int -> Int) -> (Natural a a', Natural b b') -> Natural c c' -> Natural d d' Source #

Auxiliary function that promotes ternary (binary) Int functions to Natural functions.

coerceNat3 :: (Int -> Int -> a) -> Natural b b' -> Natural c c' -> a Source #

Auxiliary function that promotes ternary (binary) Int functions to Natural functions.

List data type

newtype List a Source #

Powerset data type.

This data type is a newtype wrapper around '[]'. This exists in order to implement an Enum and Bounded instance that cannot be harmful for the outside.

Constructors

L [a] 
Instances
(Enum a, Bounded a) => Bounded (List a) Source # 
Instance details

Defined in LAoP.Utils.Internal

Methods

minBound :: List a #

maxBound :: List a #

(Bounded a, Enum a, Eq a) => Enum (List a) Source # 
Instance details

Defined in LAoP.Utils.Internal

Methods

succ :: List a -> List a #

pred :: List a -> List a #

toEnum :: Int -> List a #

fromEnum :: List a -> Int #

enumFrom :: List a -> [List a] #

enumFromThen :: List a -> List a -> [List a] #

enumFromTo :: List a -> List a -> [List a] #

enumFromThenTo :: List a -> List a -> List a -> [List a] #

Eq a => Eq (List a) Source # 
Instance details

Defined in LAoP.Utils.Internal

Methods

(==) :: List a -> List a -> Bool #

(/=) :: List a -> List a -> Bool #

Read a => Read (List a) Source # 
Instance details

Defined in LAoP.Utils.Internal

Show a => Show (List a) Source # 
Instance details

Defined in LAoP.Utils.Internal

Methods

showsPrec :: Int -> List a -> ShowS #

show :: List a -> String #

showList :: [List a] -> ShowS #

Category type class

class Category k where Source #

Constrained category instance

Associated Types

type Object k o :: Constraint Source #

Methods

id :: Object k a => k a a Source #

(.) :: k b c -> k a b -> k a c Source #

Instances
Category Relation Source #

It is possible to implement a constrained version of the category type class.

Instance details

Defined in LAoP.Relation.Internal

Associated Types

type Object Relation o :: Constraint Source #

Methods

id :: Object Relation a => Relation a a Source #

(.) :: Relation b c -> Relation a b -> Relation a c Source #

Num e => Category (Matrix e) Source #

It is possible to implement a constrained version of the category type class.

Instance details

Defined in LAoP.Matrix.Internal

Associated Types

type Object (Matrix e) o :: Constraint Source #

Methods

id :: Object (Matrix e) a => Matrix e a a Source #

(.) :: Matrix e b c -> Matrix e a b -> Matrix e a c Source #

Num e => Category (Matrix e) Source #

It is possible to implement a constrained version of the category type class.

Instance details

Defined in LAoP.Matrix.Type

Associated Types

type Object (Matrix e) o :: Constraint Source #

Methods

id :: Object (Matrix e) a => Matrix e a a Source #

(.) :: Matrix e b c -> Matrix e a b -> Matrix e a c Source #

Category ((->) :: Type -> Type -> Type) Source # 
Instance details

Defined in LAoP.Utils.Internal

Associated Types

type Object (->) o :: Constraint Source #

Methods

id :: Object (->) a => a -> a Source #

(.) :: (b -> c) -> (a -> b) -> a -> c Source #

Orphan instances

(Bounded a, Bounded b) => Bounded (Either a b) Source # 
Instance details

Methods

minBound :: Either a b #

maxBound :: Either a b #

(Enum a, Bounded a, Enum b, Bounded b) => Enum (Either a b) Source # 
Instance details

Methods

succ :: Either a b -> Either a b #

pred :: Either a b -> Either a b #

toEnum :: Int -> Either a b #

fromEnum :: Either a b -> Int #

enumFrom :: Either a b -> [Either a b] #

enumFromThen :: Either a b -> Either a b -> [Either a b] #

enumFromTo :: Either a b -> Either a b -> [Either a b] #

enumFromThenTo :: Either a b -> Either a b -> Either a b -> [Either a b] #

(Enum a, Enum b, Bounded b) => Enum (a, b) Source #

Optimized Enum instance for tuples that comply with the given constraints.

Instance details

Methods

succ :: (a, b) -> (a, b) #

pred :: (a, b) -> (a, b) #

toEnum :: Int -> (a, b) #

fromEnum :: (a, b) -> Int #

enumFrom :: (a, b) -> [(a, b)] #

enumFromThen :: (a, b) -> (a, b) -> [(a, b)] #

enumFromTo :: (a, b) -> (a, b) -> [(a, b)] #

enumFromThenTo :: (a, b) -> (a, b) -> (a, b) -> [(a, b)] #