-
Notifications
You must be signed in to change notification settings - Fork 246
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add NonNull
to Data.List.Relation.Unary.NonNull
on the model of Data.Nat.Base.NonZero
#2260
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am strongly against this addition to Data.List.Base
. This feels like a 'bad smell' coming from non-dependently-typed programming where you don't want to say that you know your list is non-null but want to defer this to proof search instead.
Can NonNull
exist in stdlib
in some module that I personally will never import? Sure!
@JacquesCarette Ouch! OK... ... easy enough, I guess, to punt this to But as the PR makes clear, this began as a simple-minded emulation of the compromise we already make in Here, not so much, because we don't have the same commitment to (meta: Maybe these last two paragraphs belong on the issue #2092, but no-one has commented on that since I posted it... DONE) |
That punt definitely would make me happy. I agree that this is analogical (in design) to I feel like we have not explore the full design space of principled solutions for nonnull reasoning. To me, the conclusion that I draw from the |
NonNull
to Data.List.Base
on the model of Data.Nat.Base.NonZero
NonNull
to Data.List.Relation.Unary.NonNull
on the model of Data.Nat.Base.NonZero
Have resolved the merge conflict wrt |
This is a cherry-picked/revised version of #2092 / #2103 specialised to
List
only, prompted by the discussion inthis stackoverflow question
Outstanding issues:
head
andtail
are defined; (so also: naming)no properties added toperhaps the constructors/destructors should moveData.List.Properties
; buttheretoData.List.Relation.Unary.NonNull.Properties
;README.*
;Data.List.NonEmpty
;Yields the following solution to the above
stackoverflow
problem:Coupled with the redefinition of
scanr
in #2258 , this solution then simplifies further to: