summaryrefslogtreecommitdiff
path: root/lib/Data/Packed/Internal/Common.hs
diff options
context:
space:
mode:
authorAlberto Ruiz <aruiz@um.es>2014-05-06 08:50:50 +0200
committerAlberto Ruiz <aruiz@um.es>2014-05-06 08:50:50 +0200
commitc9914d694d3b86ece46fa0c76e0466c6cd394d14 (patch)
tree7fa1c5a95b204912f5d560c843ae6045ee8d2780 /lib/Data/Packed/Internal/Common.hs
parent4078cf44c98b42960be27843782f6983bb66017f (diff)
extend conformability to empty arrays
Diffstat (limited to 'lib/Data/Packed/Internal/Common.hs')
-rw-r--r--lib/Data/Packed/Internal/Common.hs6
1 files changed, 5 insertions, 1 deletions
diff --git a/lib/Data/Packed/Internal/Common.hs b/lib/Data/Packed/Internal/Common.hs
index 49f17b0..edef3c2 100644
--- a/lib/Data/Packed/Internal/Common.hs
+++ b/lib/Data/Packed/Internal/Common.hs
@@ -49,7 +49,11 @@ common f = commonval . map f where
49compatdim :: [Int] -> Maybe Int 49compatdim :: [Int] -> Maybe Int
50compatdim [] = Nothing 50compatdim [] = Nothing
51compatdim [a] = Just a 51compatdim [a] = Just a
52compatdim (a:b:xs) = if a==b || a==1 || b==1 then compatdim (max a b:xs) else Nothing 52compatdim (a:b:xs)
53 | a==b = compatdim (b:xs)
54 | a==1 = compatdim (b:xs)
55 | b==1 = compatdim (a:xs)
56 | otherwise = Nothing
53 57
54-- | Formatting tool 58-- | Formatting tool
55table :: String -> [[String]] -> String 59table :: String -> [[String]] -> String