From 9336a88cb9702c9e272ad6f7b9274635967f3682 Mon Sep 17 00:00:00 2001 From: VegOwOtenks Date: Tue, 12 Aug 2025 14:51:25 +0200 Subject: [PATCH] feat: prettied up ImplicitMap show and read --- src/Data/Map/Implicit.hs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Data/Map/Implicit.hs b/src/Data/Map/Implicit.hs index 83d5c4a..ac0d459 100644 --- a/src/Data/Map/Implicit.hs +++ b/src/Data/Map/Implicit.hs @@ -24,7 +24,7 @@ newtype ImplicitMap v = ImplicitMap { get :: Map (KeyType v) v } type ImplicitMapElems :: Type -> Type type role ImplicitMapElems representational -newtype ImplicitMapElems v = ImplicitMapElems { elems :: [v] } +newtype ImplicitMapElems v = ImplicitMapElems [v] deriving stock (Show, Read) instance (Show v) => Show (ImplicitMap v) where @@ -33,7 +33,7 @@ instance (Show v) => Show (ImplicitMap v) where instance (Read v, ImplicitKeyOf v, Ord (KeyType v)) => Read (ImplicitMap v) where readPrec :: ReadPrec (ImplicitMap v) - readPrec = ImplicitMap . Map.fromList . List.map (keyOf &&& id) . elems <$> readPrec + readPrec = ImplicitMap . Map.fromList . List.map (keyOf &&& id) . (\(ImplicitMapElems es) -> es) <$> readPrec type ImplicitKeyOf :: Type -> Constraint class ImplicitKeyOf v where