summaryrefslogtreecommitdiff
path: root/lib/Numeric
diff options
context:
space:
mode:
Diffstat (limited to 'lib/Numeric')
-rw-r--r--lib/Numeric/ContainerBoot.hs30
1 files changed, 25 insertions, 5 deletions
diff --git a/lib/Numeric/ContainerBoot.hs b/lib/Numeric/ContainerBoot.hs
index d50dd36..dcb326c 100644
--- a/lib/Numeric/ContainerBoot.hs
+++ b/lib/Numeric/ContainerBoot.hs
@@ -510,20 +510,40 @@ type instance ElementOf (Matrix a) = a
510class Build f where 510class Build f where
511 build' :: BoundsOf f -> f -> ContainerOf f 511 build' :: BoundsOf f -> f -> ContainerOf f
512 512
513type family BoundsOf x
514 513
514#if MIN_VERSION_base(4,7,0)
515-- ghc >= 7.7 considers:
516--
517-- > a -> a
518-- > b -> b -> b
519--
520-- to overlap
521type family BoundsOf x where
522 BoundsOf (a -> a) = Int
523 BoundsOf (a->a->a) = (Int,Int)
524type family ContainerOf x where
525 ContainerOf (a->a) = Vector a
526 ContainerOf (a->a->a) = Matrix a
527#else
528type family BoundsOf x
529type family ContainerOf x
515type instance BoundsOf (a->a) = Int 530type instance BoundsOf (a->a) = Int
516type instance BoundsOf (a->a->a) = (Int,Int) 531type instance BoundsOf (a->a->a) = (Int,Int)
517
518type family ContainerOf x
519
520type instance ContainerOf (a->a) = Vector a 532type instance ContainerOf (a->a) = Vector a
521type instance ContainerOf (a->a->a) = Matrix a 533type instance ContainerOf (a->a->a) = Matrix a
534#endif
535
522 536
523instance (Element a, Num a) => Build (a->a) where 537instance (Element a, Num a) => Build (a->a) where
524 build' = buildV 538 build' = buildV
525 539
526instance (Element a, Num a) => Build (a->a->a) where 540instance (Element a,
541#if MIN_VERSION_base(4,7,0)
542 BoundsOf (a -> a -> a) ~ (Int,Int),
543 ContainerOf (a -> a -> a) ~ Matrix a,
544#endif
545 Num a)
546 => Build (a->a->a) where
527 build' = buildM 547 build' = buildM
528 548
529buildM (rc,cc) f = fromLists [ [f r c | c <- cs] | r <- rs ] 549buildM (rc,cc) f = fromLists [ [f r c | c <- cs] | r <- rs ]