on master help sign in
Simplified overlappable instances in FromLists type class
commitceee0a206afb6c0e743eefa852b930abfc83f21b authorArmando Santos <armandoifsantos@gmail.com> dateSun 10 May 2020, 15:40 (6 years ago) parent87fd633
1 file changed+5−4
src/LAoP/Matrix/Internal.hs+5−4
src/LAoP/Matrix/Internal.hs+5−4
@@ -174,6 +174,7 @@ import Data.Kind
174174import Data.List
175175import Data.Maybe
176176import Data.Proxy
177+import Data.Typeable
177178import Data.Void
178179import GHC.TypeLits
179180import Data.Type.Equality
@@ -315,11 +316,11 @@ class FromLists cols rows where
315316 -- error if the dimensions do not match.
316317 fromLists :: [[e]] -> Matrix e cols rows
317318
318−instance {-# OVERLAPPING #-} FromLists () () where
319+instance FromLists () () where
319320 fromLists [[e]] = One e
320321 fromLists _ = error "Wrong dimensions"
321322
322−instance {-# OVERLAPPING #-} (FromLists cols ()) => FromLists (Either () cols) () where
323+instance (FromLists cols ()) => FromLists (Either () cols) () where
323324 fromLists [h : t] = Join (One h) (fromLists [t])
324325 fromLists _ = error "Wrong dimensions"
325326
@@ -329,7 +330,7 @@ instance {-# OVERLAPPABLE #-} (FromLists a (), FromLists b (), Countable a) => F
329330 in Join (fromLists [take rowsA l]) (fromLists [drop rowsA l])
330331 fromLists _ = error "Wrong dimensions"
331332
332−instance {-# OVERLAPPING #-} (FromLists () rows) => FromLists () (Either () rows) where
333+instance (FromLists () rows) => FromLists () (Either () rows) where
333334 fromLists ([h] : t) = Fork (One h) (fromLists t)
334335 fromLists _ = error "Wrong dimensions"
335336
@@ -339,7 +340,7 @@ instance {-# OVERLAPPABLE #-} (FromLists () a, FromLists () b, Countable a) => F
339340 in Fork (fromLists (take rowsA l)) (fromLists (drop rowsA l))
340341 fromLists _ = error "Wrong dimensions"
341342
342−instance {-# OVERLAPPABLE #-} (FromLists (Either a b) c, FromLists (Either a b) d, Countable c) => FromLists (Either a b) (Either c d) where
343+instance (FromLists (Either a b) c, FromLists (Either a b) d, Countable c) => FromLists (Either a b) (Either c d) where
343344 fromLists l@(h : t) =
344345 let lh = length h
345346 rowsC = fromInteger (natVal (Proxy :: Proxy (Count c)))