Skip to content

Commit

Permalink
Added Read instance for DMap
Browse files Browse the repository at this point in the history
  • Loading branch information
mokus0 committed Jul 12, 2011
1 parent 486038c commit a984756
Showing 1 changed file with 9 additions and 14 deletions.
23 changes: 9 additions & 14 deletions src/Data/Dependent/Map.hs
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,7 @@ import Data.GADT.Compare
import Data.Maybe (isJust)
import Data.Monoid
import Data.Typeable
import Text.Read

instance (GCompare k) => Monoid (DMap k) where
mempty = empty
Expand Down Expand Up @@ -1024,20 +1025,14 @@ instance OrdTag k => Ord (DMap k) where
{--------------------------------------------------------------------
Read
--------------------------------------------------------------------}
-- instance (GCompare k, Read k, Read e) => Read (Map k e) where
-- #ifdef __GLASGOW_HASKELL__
-- readPrec = parens $ prec 10 $ do
-- Ident "fromList" <- lexP
-- xs <- readPrec
-- return (fromList xs)
--
-- readListPrec = readListPrecDefault
-- #else
-- readsPrec p = readParen (p > 10) $ \ r -> do
-- ("fromList",s) <- lex r
-- (xs,t) <- reads s
-- return (fromList xs,t)
-- #endif

instance (GCompare f, ReadTag f) => Read (DMap f) where
readPrec = parens $ prec 10 $ do
Ident "fromList" <- lexP
xs <- readPrec
return (fromList xs)

readListPrec = readListPrecDefault

{--------------------------------------------------------------------
Show
Expand Down

0 comments on commit a984756

Please sign in to comment.