summaryrefslogtreecommitdiff
path: root/lib/Data/Packed/Internal/Common.hs
diff options
context:
space:
mode:
Diffstat (limited to 'lib/Data/Packed/Internal/Common.hs')
-rw-r--r--lib/Data/Packed/Internal/Common.hs8
1 files changed, 7 insertions, 1 deletions
diff --git a/lib/Data/Packed/Internal/Common.hs b/lib/Data/Packed/Internal/Common.hs
index 629016d..972cd7d 100644
--- a/lib/Data/Packed/Internal/Common.hs
+++ b/lib/Data/Packed/Internal/Common.hs
@@ -18,7 +18,7 @@ module Data.Packed.Internal.Common(
18 Adapt, 18 Adapt,
19 app1, app2, app3, app4, 19 app1, app2, app3, app4,
20 (//), check, 20 (//), check,
21 partit, common, 21 partit, common, compatdim,
22 fi 22 fi
23) where 23) where
24 24
@@ -41,6 +41,12 @@ common f = commonval . map f where
41 commonval [a] = Just a 41 commonval [a] = Just a
42 commonval (a:b:xs) = if a==b then commonval (b:xs) else Nothing 42 commonval (a:b:xs) = if a==b then commonval (b:xs) else Nothing
43 43
44-- | common value with \"adaptable\" 1
45compatdim :: [Int] -> Maybe Int
46compatdim [] = Nothing
47compatdim [a] = Just a
48compatdim (a:b:xs) = if a==b || a==1 || b==1 then compatdim (max a b:xs) else Nothing
49
44-- | postfix function application (@flip ($)@) 50-- | postfix function application (@flip ($)@)
45(//) :: x -> (x -> y) -> y 51(//) :: x -> (x -> y) -> y
46infixl 0 // 52infixl 0 //