ekmett / placeholder

todo and unimplemented, robustly implemented
Other
32 stars 1 forks source link

hackage release #9

Closed MangoIV closed 1 week ago

MangoIV commented 1 month ago

Hi! It appears that the todo base proposal is dead, so perhaps we can upload this to hackage. I have some documentation change proposals from my MR to GHC

Namely, I have added this collapsible section to todo

--
-- ==== __Representation Polymorphism__
--
-- 'todo', in contrast to 'TODO', is fully representation polymorphic
--

And this part of the documentation to TODO

-- This pattern synonym is marked @COMPLETE@, implying that every match after matching on 'TODO'
-- will /emit a redundant pattern match warning/. Adding new options to your datatype, similarly
-- to how wildcard patterns (patterns starting with an underscore) work, will /not cause any warnings or errors/.
--
-- ==== __Examples__
--
-- Since the pattern match is strict, even if the branch itself does not evaluate to bottom, matching on
-- 'TODO' will.
--
-- @
-- >>> x = []
-- >>> case x of
-- ...   (x : _) -> x
-- ...   'TODO' -> 42
-- *** Exception: Develop.Placeholder.todo: not yet implemented
-- @
--
-- As usual, this behaviour can be reversed by using a @~@ in front of 'TODO' in pattern position.
--
-- @
-- >>> x = []
-- >>> case x of
-- ...   (x : _) -> x
-- ...   ~'TODO' -> 42
-- 42
-- @
--
-- In most situations, 'TODO' can be used just like 'todo', where the above is equivalent to the below
--
-- @
-- >>> y :: 'Data.Int.Int' = 'todo'
-- >>> x :: 'Data.Int.Int' = 'TODO'
-- @
--
--
-- ==== __Representation Polymorphism__
--
-- Mind that pattern synonyms may not be representation polymorphic, hence, if you need something
-- that can be used with some kind other than 'Data.Kind.Type', you have to use 'todo'. For example,
-- 'TODO' cannot stand instead of a pattern match on an @'GHC.Exts.Int#' :: 'TYPE' 'GHC.Exts.IntRep'@
-- or as a placeholder for a @'GHC.Exts.ByteArray#' :: 'GHC.Exts.UnliftedType'@
--

Rendered:

Let me know if you like these changes, if yes, I will open an MR.

tomjaguarpaw commented 3 weeks ago

Thanks for instigating this @MangoIV. I'm very much in support, and willing to be a co-maintainer if people would like help.

tomjaguarpaw commented 3 weeks ago

Pinging @ekmett to please share your thoughts on this. We have enough interested parties that this will not require any of your time or effort, Ed, but I don't want to just plough ahead without giving you the chance to respond.

ekmett commented 3 weeks ago

Works for me. I admit I tuned out on the todo thing because I thought the proposal was going into base in the more limited form. I'm more than happy to merge a documentation PR and to ship this to hackage.

tomjaguarpaw commented 3 weeks ago

Fabulous. @MangoIV, are you wiling to make the documentation PR as shown above?

MangoIV commented 3 weeks ago

@tomjaguarpaw done in #10