diff options
author | Tom Smeding <tom@tomsmeding.com> | 2024-06-17 12:04:09 +0200 |
---|---|---|
committer | Tom Smeding <tom@tomsmeding.com> | 2024-06-17 12:04:09 +0200 |
commit | 2ca90987058d14c79cd983ab14ee57949bae2871 (patch) | |
tree | 1f81d469fbf9eba174fc0d7c40b5626123830cb8 /src/Data/Array/Nested/Internal/Mixed.hs | |
parent | 63b60c06674127e96cebfc3f1e8710f31df379d7 (diff) |
Generalise some of the lifting functions to type-changing
Diffstat (limited to 'src/Data/Array/Nested/Internal/Mixed.hs')
-rw-r--r-- | src/Data/Array/Nested/Internal/Mixed.hs | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/src/Data/Array/Nested/Internal/Mixed.hs b/src/Data/Array/Nested/Internal/Mixed.hs index ddc075c..647ea82 100644 --- a/src/Data/Array/Nested/Internal/Mixed.hs +++ b/src/Data/Array/Nested/Internal/Mixed.hs @@ -871,13 +871,13 @@ mfromXArrayPrimP ssh arr = M_Primitive (X.shape ssh arr) arr mfromXArrayPrim :: PrimElt a => StaticShX sh -> XArray sh a -> Mixed sh a mfromXArrayPrim = (fromPrimitive .) . mfromXArrayPrimP -mliftPrim :: PrimElt a - => (a -> a) - -> Mixed sh a -> Mixed sh a +mliftPrim :: (PrimElt a, PrimElt b) + => (a -> b) + -> Mixed sh a -> Mixed sh b mliftPrim f (toPrimitive -> M_Primitive sh (X.XArray arr)) = fromPrimitive $ M_Primitive sh (X.XArray (S.mapA f arr)) -mliftPrim2 :: PrimElt a - => (a -> a -> a) - -> Mixed sh a -> Mixed sh a -> Mixed sh a +mliftPrim2 :: (PrimElt a, PrimElt b, PrimElt c) + => (a -> b -> c) + -> Mixed sh a -> Mixed sh b -> Mixed sh c mliftPrim2 f (toPrimitive -> M_Primitive sh (X.XArray arr1)) (toPrimitive -> M_Primitive _ (X.XArray arr2)) = fromPrimitive $ M_Primitive sh (X.XArray (S.zipWithA f arr1 arr2)) |