Update Data.NumIdr.Scalar

This commit is contained in:
Kiana Sheibani 2022-08-04 15:19:03 -04:00
parent 95a13ffd91
commit 8384f8f68b
Signed by: toki
GPG key ID: 6CB106C25E86A9F7

View file

@ -8,7 +8,7 @@ import public Data.NumIdr.Array
%default total %default total
||| Scalars are `Array []`, the unique 0-rank array type. They hold a single value. ||| Scalars are `Array []`, the unique 0-rank array type. They hold a single value.
||| Scalars are not particularly useful as container types, but they are ||| Scalars are not particularly useful as data structures, but they are
||| included here anyways. ||| included here anyways.
public export public export
Scalar : Type -> Type Scalar : Type -> Type
@ -29,3 +29,11 @@ unwrap = index 0 . getPrim
export export
Num a => Mult (Scalar a) (Scalar a) (Scalar a) where Num a => Mult (Scalar a) (Scalar a) (Scalar a) where
(*.) = (*) (*.) = (*)
export
Num a => MultMonoid (Scalar a) where
identity = scalar 1
export
Fractional a => MultGroup (Scalar a) where
inverse = recip