diff --git a/Data/Matrix.hs b/Data/Matrix.hs index 64aacd3..03b45f8 100644 --- a/Data/Matrix.hs +++ b/Data/Matrix.hs @@ -144,7 +144,13 @@ prettyMatrix m = concat instance Show a => Show (Matrix a) where - show = prettyMatrix + show = show . toLists + +instance Read a => Read (Matrix a) where + readsPrec _ str = map toMatrix parsedLists + where + parsedLists = reads str + toMatrix (lists, str) = (fromLists lists, str) instance NFData a => NFData (Matrix a) where rnf = rnf . mvect