camfort-0.804: CamFort - Cambridge Fortran infrastructure

Safe HaskellSafe
LanguageHaskell2010

Camfort.Helpers.Vec

Documentation

data Nat Source #

Constructors

Z 
S Nat 

data Natural n where Source #

Constructors

Zero :: Natural Z 
Succ :: Natural n -> Natural (S n) 

Instances

Show (Natural n) Source # 

Methods

showsPrec :: Int -> Natural n -> ShowS #

show :: Natural n -> String #

showList :: [Natural n] -> ShowS #

data NatBox where Source #

Constructors

NatBox :: Natural n -> NatBox 

Instances

class IsNatural n where Source #

Minimal complete definition

fromNat

Methods

fromNat :: Proxy n -> Int Source #

Instances

IsNatural Z Source # 

Methods

fromNat :: Proxy Nat Z -> Int Source #

IsNatural n => IsNatural (S n) Source # 

Methods

fromNat :: Proxy Nat (S n) -> Int Source #

data Vec n a where Source #

Constructors

Nil :: Vec Z a 
Cons :: a -> Vec n a -> Vec (S n) a 

Instances

Functor (Vec n) Source # 

Methods

fmap :: (a -> b) -> Vec n a -> Vec n b #

(<$) :: a -> Vec n b -> Vec n a #

Eq a => Eq (Vec n a) Source # 

Methods

(==) :: Vec n a -> Vec n a -> Bool #

(/=) :: Vec n a -> Vec n a -> Bool #

Ord a => Ord (Vec n a) Source # 

Methods

compare :: Vec n a -> Vec n a -> Ordering #

(<) :: Vec n a -> Vec n a -> Bool #

(<=) :: Vec n a -> Vec n a -> Bool #

(>) :: Vec n a -> Vec n a -> Bool #

(>=) :: Vec n a -> Vec n a -> Bool #

max :: Vec n a -> Vec n a -> Vec n a #

min :: Vec n a -> Vec n a -> Vec n a #

Show a => Show (Vec n a) Source # 

Methods

showsPrec :: Int -> Vec n a -> ShowS #

show :: Vec n a -> String #

showList :: [Vec n a] -> ShowS #

lengthV :: Vec n a -> Int Source #

vmap :: (a -> b) -> Vec n a -> Vec n b Source #

showV :: Show a => Vec n a -> String Source #

type family Max (n :: Nat) (m :: Nat) :: Nat where ... Source #

Equations

Max Z Z = Z 
Max Z m = m 
Max m Z = m 
Max (S n) (S m) = S (Max n m) 

zipVec :: Vec m Int -> Vec n Int -> (Vec (Max n m) Int, Vec (Max n m) Int) Source #