Ticket #4807 (closed bug: wontfix)

Opened 2 years ago

Last modified 2 years ago

Data instance for Data.Map is incomplete

Reported by: sclv Owned by:
Priority: normal Milestone:
Component: libraries/base Version: 7.0.1
Keywords: Cc: jpm@…
Operating System: Unknown/Multiple Architecture: Unknown/Multiple
Type of failure: Incorrect result at runtime Difficulty:
Test Case: Blocked By:
Blocking: Related Tickets:

Description

There's no dataCast1 defined for Data.Map. This makes the ext1 family unusable with Maps, since ext is built on dataCast rather than gcast.

Observe:

Prelude Data.Data Data.Generics Data.Map> gcast1 (Just empty :: forall d. (Data d) => Maybe (Map Int d)) :: Maybe (Maybe (Map Int Int))
Just (Just (fromList []))
Prelude Data.Data Data.Generics Data.Map> dataCast1 (Just empty :: forall d. (Data d) => Maybe (Map Int d)) :: Maybe (Maybe (Map Int Int))
Nothing

Change History

Changed 2 years ago by dreixel

  • cc jpm@… added

But Map is a kind * -> * -> * datatype, so it has a dataCast2 definition instead. Won't it work properly with the (new) ext2 family of functions? See  http://hackage.haskell.org/packages/archive/syb/0.3/doc/html/Data-Generics-Aliases.html#g:6

Changed 2 years ago by sclv

I realized after submitting this ticket that it could go either way. I tend to think that it should still be possible to define a proper dataCast1, since its certainly easier to use ext1 for partially specialized maps than it is to use ext2 and enforce some of the specialization by hand. However, these things are feasible, if painful, with ext2, and I can't offhand write the dataCast1 instance myself.

If one is feasible to write, then I think its a no-brainer to add it. If it seems hard-to-impossible to write, then now we have the ext2 functions, and I agree that this is sufficient.

Changed 2 years ago by dreixel

I wouldn't know how to write dataCast1 for Map, but I also don't quite see the use case very well ("its certainly easier to use ext1 for partially specialized maps than it is to use ext2 and enforce some of the specialization by hand"). Can you give me a concrete example?

Changed 2 years ago by igloo

  • status changed from new to closed
  • resolution set to wontfix

Sounds like this is something that won't be fixed; please reopen if you disagree.

Note: See TracTickets for help on using tickets.