-
-
Notifications
You must be signed in to change notification settings - Fork 79
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 custom type errors in some places #171
Labels
Milestone
Comments
Looks like it's possible to have better custom type errors for functions like type IsNonEmpty (f :: Type -> Type) =
(f ~ NonEmpty, CheckNonEmpty f)
type family CheckNonEmpty (f :: Type -> Type) :: Constraint where
CheckNonEmpty NonEmpty = ()
CheckNonEmpty [] = TypeError ('Text "Should be NonEmpty, not ordinary list")
CheckNonEmpty _ = TypeError ('Text "Should be NonEmpty list")
head :: IsNonEmpty f => f a -> a
head = NE.head I didn't expect this work. But looks like it works. We only need to write better error messages) |
vrom911
added a commit
that referenced
this issue
Oct 16, 2019
chshersh
pushed a commit
that referenced
this issue
Oct 16, 2019
chshersh
added a commit
that referenced
this issue
Oct 16, 2019
chshersh
added a commit
that referenced
this issue
Oct 16, 2019
vrom911
pushed a commit
that referenced
this issue
Oct 16, 2019
chshersh
added a commit
that referenced
this issue
Oct 28, 2019
vrom911
added a commit
that referenced
this issue
Oct 29, 2019
chshersh
pushed a commit
that referenced
this issue
Oct 29, 2019
chshersh
added a commit
that referenced
this issue
Oct 29, 2019
vrom911
pushed a commit
that referenced
this issue
Oct 29, 2019
chshersh
added a commit
that referenced
this issue
Oct 29, 2019
chshersh
added a commit
that referenced
this issue
Oct 29, 2019
chshersh
added a commit
that referenced
this issue
Oct 29, 2019
chshersh
added a commit
that referenced
this issue
Oct 29, 2019
vrom911
pushed a commit
that referenced
this issue
Oct 30, 2019
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
This is a meta-issue to collect all places where custom type errors can be introduced to increase the quality of error messages and make
relude
more beginner-friendlyFoldable1
for ordinary listToString/ToText/ToLText/ConvertUtf8
for text data types: suggest proper function.head/tail/init/last
lines/unlines/words/unwords
error
Any other ideas? 🙂
Also, open question: is it worth to add
type-errors-pretty
to dependencies to write these errors?The text was updated successfully, but these errors were encountered: