Safe Haskell | None |
---|---|
Language | Haskell2010 |
Synopsis
- newtype Natural (start :: Nat) (end :: Nat) = Nat Int
- nat :: forall n m. (KnownNat n, KnownNat m) => Int -> Natural n m
- coerceNat :: (Int -> Int -> Int) -> Natural a a' -> Natural b b' -> Natural c c'
- coerceNat2 :: ((Int, Int) -> Int -> Int) -> (Natural a a', Natural b b') -> Natural c c' -> Natural d d'
- coerceNat3 :: (Int -> Int -> a) -> Natural b b' -> Natural c c' -> a
- newtype List a = L [a]
Natural
data type
newtype Natural (start :: Nat) (end :: Nat) Source #
Wrapper around Int
s that have a restrictive semantic associated.
A value of type
can only be instanciated with some Natural
n mInt
i
that's n <= i <= m
.
Instances
(KnownNat n, KnownNat m) => Bounded (Natural n m) Source # | |
(KnownNat n, KnownNat m) => Enum (Natural n m) Source # | |
Defined in LAoP.Utils.Internal 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 # | |
(KnownNat n, KnownNat m) => Num (Natural n m) Source # | Throws a runtime error if any of the operations overflows or underflows. |
Defined in LAoP.Utils.Internal (+) :: 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 # | |
Defined in LAoP.Utils.Internal 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 # | |
Show (Natural start end) Source # | |
Generic (Natural start end) Source # | |
NFData (Natural start end) Source # | |
Defined in LAoP.Utils.Internal | |
type Rep (Natural start end) Source # | |
Defined in LAoP.Utils.Internal |
Coerce auxiliar functions to help promote Int
typed functions to
coerceNat2 :: ((Int, Int) -> Int -> Int) -> (Natural a a', Natural b b') -> Natural c c' -> Natural d d' Source #
List
data type
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.
L [a] |
Orphan instances
(Bounded a, Bounded b) => Bounded (Either a b) Source # | |
(Enum a, Bounded a, Enum b, Bounded b) => Enum (Either a b) Source # | |
succ :: Either a b -> Either a b # pred :: Either a b -> 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 |