-
Notifications
You must be signed in to change notification settings - Fork 54
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
Recommend MonadFailDesugaring? #85
Comments
By the same token we should recommend stack --resolver ghc-8.4.1 exec ghci
GHCi, version 8.4.1: http://www.haskell.org/ghc/ :? for help
Loaded GHCi configuration from /Users/chris/.ghci
Prelude> :set -Wall
Prelude> let f = x where Just x = Nothing
Prelude> :set -fwarn-incomplete-uni-patterns
Prelude> let g = x where Just x = Nothing
<interactive>:5:17: warning: [-Wincomplete-uni-patterns]
Pattern match(es) are non-exhaustive
In a pattern binding: Patterns not matched: Nothing
Prelude> |
+1 to both of these. It's unfortunate that |
I haven't used this extension myself previously, so my understanding may not be perfect. Consider this script:
As is, it will crash at runtime with:
Note that even with
-Wall -Werror
turned on, the compiler does nothing to prevent us from the partial pattern matchJust x <- return Nothing
. By contrast, if we uncomment the{-# LANGUAGE MonadFailDesugaring #-}
line, we get a compiler time error due to a missingMonadFail
instance instead:It seems preferable to me to totally block partial pattern matches via this language extension and lack of
MonadFail
instance forRIO
.The text was updated successfully, but these errors were encountered: