[GHC] #15224: Add -fwan-sum-type-partial-field-accessor

#15224: Add -fwan-sum-type-partial-field-accessor -------------------------------------+------------------------------------- Reporter: erikd | Owner: (none) Type: feature | Status: new request | Priority: normal | Milestone: 8.6.1 Component: Compiler | Version: 8.4.3 Keywords: | Operating System: Unknown/Multiple Architecture: | Type of failure: None/Unknown Unknown/Multiple | Test Case: | Blocked By: Blocking: | Related Tickets: Differential Rev(s): | Wiki Page: -------------------------------------+------------------------------------- This a a new warning flag that would be off by default and warns when a sum type is defined with field accessors that are partial. For an example of something that would trigger the warning: {{{#!hs data Option a = Some { getSome :: a } | None }}} In production quality Haskell code it usually desirable to outright ban partial functions like `head`, `fromJust` etc by use of a custom prelude. Unfortunately partial functions can still sneak into a code base via field accessors in sum types. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/15224 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#15224: Add -fwan-sum-type-partial-field-accessor -------------------------------------+------------------------------------- Reporter: erikd | Owner: erikd Type: feature request | Status: new Priority: normal | Milestone: 8.6.1 Component: Compiler | Version: 8.4.3 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Changes (by erikd): * owner: (none) => erikd -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/15224#comment:1 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#15224: Add -fwan-sum-type-partial-field-accessor -------------------------------------+------------------------------------- Reporter: erikd | Owner: erikd Type: feature request | Status: closed Priority: normal | Milestone: 8.6.1 Component: Compiler | Version: 8.4.3 Resolution: invalid | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Changes (by erikd): * status: new => closed * resolution: => invalid Comment: Never mind. This seems to be `-fwarn-partial-fields`. Closing this. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/15224#comment:2 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler
participants (1)
-
GHC